#1
  1. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,664
    Rep Power
    171

    Howcom view source shows the scripts content!


    Hello

    How are you?

    This is not a php issue really but I thought I post here this is home.

    Recently when I view source, I see the content of all <script> tags for some reason!

    For example instead of

    <script src="color.js"></script>

    I see its content as below:

    Code:
    img.tcalIcon{cursor:pointer;margin-left:1px;vertical-align:middle;}/**/div#tcal{position:absolute;visibility:hidden;z-index:100;width:158px;padding:2px 0 0 0;}/**/div#tcal table{width:100%;border:1px solid silver;border-collapse:collapse;background-color:white;}/**/div#tcal table.ctrl{border-bottom:0;}/**/div#tcal table.ctrl td{width:15px;height:20px;}/**/div#tcal table.ctrl th{background-color:white;color:black;border:0;}/**/div#tcal th{border:1px solid silver;border-collapse:collapse;text-align:center;padding:3px 0;font-family:tahoma,verdana,arial;font-size:10px;background-color:gray;color:white;}/**/div#tcal td{border:0;border-collapse:collapse;text-align:center;padding:2px 0;font-family:tahoma,verdana,arial;font-size:11px;width:22px;cursor:pointer;}/**/div#tcal td.othermonth{color:silver;}div#tcal td.weekend{background-color:#ACD6F5;}div#tcal td.today{border:1px solid red;}div#tcal td.selected{background-color:#FFB3BE;}/**/iframe#tcalIF{position:absolute;visibility:hidden;z-index:98;border:0;}/**/div#tcalShade{position:absolute;visibility:hidden;z-index:99;}div#tcalShade table{border:0;border-collapse:collapse;width:100%;}div#tcalShade table td{border:0;border-collapse:collapse;padding:0;}
    </style>
    <link rel="stylesheet" type="text/css" href="css/prototip.css" /><link href="css/default.css" rel="stylesheet" type="text/css" media="screen" /><link rel="shortcut icon" href="favicon.ico" /><style type="text/css"><!-- @import url("css/default.css");--></style> <!--[if lt IE 7.]><script defer type="text/javascript" src="pngfix.js"></script> <![endif]--><!--[if IE 7]><style type="text/css" media="all">@charset"utf-8";#nav_container ul li.left a.left{&margin-left:232px;}#nav_container ul li ul{display:none;position:absolute;top:38px;&left:283px;z-index:550;border-bottom:solid 0px #999999;padding-left:10px;}#nav_container ul li ul.r{&left:765px;}</style> <![endif]--><script type='text/javascript' src="scriptaculous/src/scriptaculous.js"></script> <script type='text/javascript' src='httdps://ajax.googleapis.com/ajax/libs/prototype/1/prototype.js'></script> <script type='text/javascript'  style="display:none">var A_TCALDEF={'months':['January','February','March','April','May','June','July','August','September','October','November','December'],'weekdays':['Su','Mo','Tu','We','Th','Fr','Sa'],'yearscroll':true,'weekstart':0,'centyear':70,'imgpath':'img/'};function f_tcalParseDate(s_date){var re_date=/^\s*(\d{1,2})\/(\d{1,2})\/(\d{2,4})\s*$/;if(!re_date.exec(s_date))
    return alert("Invalid date: '"+s_date+"'.\nAccepted format is dd/mm/yyyy.")
    var n_day=Number(RegExp.$1),n_month=Number(RegExp.$2),n_year=Number(RegExp.$3);if(n_year<100)
    n_year+=(n_year<this.a_tpl.centyear?2000:1900);if(n_month<1||n_month>12)
    return alert("Invalid month value: '"+n_month+"'.\nAllowed range is 01-12.");var d_numdays=new Date(n_year,n_month,0);if(n_day>d_numdays.getDate())
    return alert("Invalid day of month value: '"+n_day+"'.\nAllowed range for selected month is 01 - "+d_numdays.getDate()+".");return new Date(n_year,n_month-1,n_day);}
    function f_tcalGenerDate(d_date){return((d_date.getDate()<10?'0':'')+d_date.getDate()+"/"
    +(d_date.getMonth()<9?'0':'')+(d_date.getMonth()+1)+"/"
    +d_date.getFullYear());}
    function tcal(a_cfg,a_tpl){if(!a_tpl)
    a_tpl=A_TCALDEF;if(!window.A_TCALS)
    window.A_TCALS=[];if(!window.A_TCALSIDX)
    window.A_TCALSIDX=[];this.s_id=a_cfg.id?a_cfg.id:A_TCALS.length;window.A_TCALS[this.s_id]=this;window.A_TCALSIDX[window.A_TCALSIDX.length]=this;this.f_show=f_tcalShow;this.f_hide=f_tcalHide;this.f_toggle=f_tcalToggle;this.f_update=f_tcalUpdate;this.f_relDate=f_tcalRelDate;this.f_parseDate=f_tcalParseDate;this.f_generDate=f_tcalGenerDate;this.s_iconId='tcalico_'+this.s_id;this.e_icon=f_getElement(this.s_iconId);if(!this.e_icon){document.write('<img src="'+a_tpl.imgpath+'cal.gif" id="'+this.s_iconId+'" onclick="A_TCALS[\''+this.s_id+'\'].f_toggle()" class="tcalIcon" alt="Open Calendar" />');this.e_icon=f_getElement(this.s_iconId);}
    this.a_cfg=a_cfg;this.a_tpl=a_tpl;}
    function f_tcalShow(d_date){if(!this.a_cfg.controlname)
    throw("TC: control name is not specified");if(this.a_cfg.formname){var e_form=document.forms[this.a_cfg.formname];if(!e_form)
    throw("TC: form '"+this.a_cfg.formname+"' can not be found");this.e_input=e_form.elements[this.a_cfg.controlname];}
    else
    this.e_input=f_getElement(this.a_cfg.controlname);if(!this.e_input||!this.e_input.tagName||this.e_input.tagName!='INPUT')
    throw("TC: element '"+this.a_cfg.controlname+"' does not exist in "
    +(this.a_cfg.formname?"form '"+this.a_cfg.controlname+"'":'this document'));this.e_div=f_getElement('tcal');if(!this.e_div){this.e_div=document.createElement("DIV");this.e_div.id='tcal';document.body.appendChild(this.e_div);}
    this.e_shade=f_getElement('tcalShade');if(!this.e_shade){this.e_shade=document.createElement("DIV");this.e_shade.id='tcalShade';document.body.appendChild(this.e_shade);}
    t.....
  2. #2
  3. Code Monkey V. 0.9
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2005
    Location
    A Land Down Under
    Posts
    2,111
    Rep Power
    1990
    What you've copied there is correct. When you actually look at the tags with correct formatting, the JS script links are:

    Code:
    <script type='text/javascript' src="scriptaculous/src/scriptaculous.js"></script>
    <script type='text/javascript' src='httdps://ajax.googleapis.com/ajax/libs/prototype/1/prototype.js'></script>
    <script type='text/javascript'  style="display:none">
        var A_TCALDEF={'months':['January','February','March'...
    The JS code there is set up in a standard script tag the way that it should be. There's no JS that's being displayed from the external files.
  4. #3
  5. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,664
    Rep Power
    171
    Originally Posted by Catacaustic
    What you've copied there is correct. When you actually look at the tags with correct formatting, the JS script links are:

    Code:
    <script type='text/javascript' src="scriptaculous/src/scriptaculous.js"></script>
    <script type='text/javascript' src='httdps://ajax.googleapis.com/ajax/libs/prototype/1/prototype.js'></script>
    <script type='text/javascript'  style="display:none">
        var A_TCALDEF={'months':['January','February','March'...
    The JS code there is set up in a standard script tag the way that it should be. There's no JS that's being displayed from the external files.
    It used to be different! Never saw the actual JS code.
  6. #4
  7. Code Monkey V. 0.9
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2005
    Location
    A Land Down Under
    Posts
    2,111
    Rep Power
    1990
    What exactly "used to be different"?
  8. #5
  9. For POny!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Location
    Amsterdam
    Posts
    416
    Rep Power
    115
    pay close attention to what catacaustic said.
    prototype.js & scriptaculous.js don't show the code (they have a src attribute)
    the other script tag doesn't and thus kind of forced to have the actual JS inside the tags
  10. #6
  11. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,664
    Rep Power
    171
    Previously I used to see only
    Code:
    <script type='text/javascript' src="scriptaculous/src/scriptaculous.js"></script>
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2009
    Posts
    677
    Rep Power
    7
    So, this is your code you are writing, and you didn't even add prototype.js?
  14. #8
  15. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    As stated previously, if the script tags contains a src attribute then the body does not contain code. If the script tag does not contain a src attribute, then either the body contains code or the tag is useless. There is never any type of automatic conversion between the two methods.

    If your code used to be different, it's because the code was changed. We can't tell you who changed it or why of course.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

IMN logo majestic logo threadwatch logo seochat tools logo