Forum Moderators: open
1) There are tons of category on the site (site on profile).
2) I would like to make a sub dir under root, called /jsfiles/
3) I have heard at WebmasterWorld that absolute link cannot be used but I found couple sites, that says something different [ (a) [javascript-fx.com...] & (b) [html4me.com...] ]
I was wondering, if you I can get some suggestion, on how I can use absolute path to external.js for below code
<script language='JavaScript' type='text/javascript'>
<!--
if (!document.phpAds_used) document.phpAds_used = ',';
document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
document.write ("http://ads.needscripts.com/adjs.php?n=aa2d578c");
document.write ("&what=zone:29");
document.write ("&exclude=" + document.phpAds_used);
document.write ("'><" + "/script>");
//-->
</script><noscript><a href='http://ads.needscripts.com/adclick.php?n=aa2d578c'><img src='http://ads.needscripts.com/adview.php?what=zone:29&n=aa2d578c' border='0' alt=''></a></noscript>
Thanks for the help.
Put <script src="/jsfiles/ads.js"> </script> in head
Sorry for another stupid question.
Suppose I put <script src="http://www.domain.com/jsfiles/ads.js"> </script> in head, but how will the banner show up on the differnt part of page?
And when you say put everything in /jsfiles/ads.js file, with everything you mean
<script language='JavaScript' type='text/javascript'>
<!--
if (!document.phpAds_used) document.phpAds_used = ',';
document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
document.write ("http://ads.needscripts.com/adjs.php?n=aa2d578c");
document.write ("&what=zone:29");
document.write ("&exclude=" + document.phpAds_used);
document.write ("'><" + "/script>");
//-->
</script><noscript><a href='http://ads.needscripts.com/adclick.php?n=aa2d578c'><img src='http://ads.needscripts.com/adview.php?what=zone:29&n=aa2d578c' border='0' alt=''></a></noscript>
right?
I am not sure about the noscript tag maybe you could use SSI to add the code.
Hey, that was the problem, I tried tons of tricks but nothing worked, however, lastly after reading your post, I tried removing the noscript tag and *boom*, it worked.
Now another problem. Is there a way, I can also include the SSI tag or noscript in the ads.js file? cuz, it would be super boring to create two files (one ssi and other .js) for every banner.
I have heard that using JavaScript on the website increases the load time, now if I were to use .js file, would the load time be changed any?
I don't think external JS is cached, I could be wrong. However a plus is the spiders will bypass the external JS and this will in turn push your content closer up to the <body> tag.
Brian
Don't forget to include the type="text/javascript" and the language="javascript" attributes within the script tag.
Note that script tags can go within the head or body, but noscript tags must only go in the body section of an HTML document.