View Full Version : Javascript Question
LastActionHero
July 19th, 2001, 07:35
I use a ad rotation service which uses some javascript code to rotate ads on my website.
it's like this
<script language="Javascript">
//banner rotate code
</script>
<noscript>
//for non-js people
</noscript>
So instead of putting the above code on each and every web page on my website I decided to copy the code to ads.js file and use this code to embed in the html file
<script lanuguage="Javascript" src="/ad.js"></script>
at the exact same spot where I needed the ad to be shown.
But I have problems. IE says javascript error and doesn't show the ad. Do I have to remove the script and no script tags from ad.js?
lucifer
July 19th, 2001, 10:15
you don't need the <script> tag it's not javascript
so each page has
<script lanuguage="Javascript" src="/ad.js"><noscript>
//for non-js people
</noscript>
</script>
and ad.js has
//banner rotate code
clearjade
July 22nd, 2001, 22:27
Why would u put a noscript tag inside of script tags lucifer? It defeats the whole purpose. :p
It depends on what u put in ad.js. Can u paste the code here please? Oh and I don't think u need the / in front of ad.js. If it's in the same folder then just put "ad.js", if it's in the folder before it put "../ad.js" or if it's in a subfolder put "folder/ad.js". Hope that helped. Otherwise paste the code like I said. :)
lucifer
July 23rd, 2001, 06:33
Originally posted by clearjade
Why would u put a noscript tag inside of script tags lucifer? It defeats the whole purpose. :p
cos it'll show up if there is no javascript running (excluding some early browsers). The script is in a different file
It depends on what u put in ad.js. Can u paste the code here please? Oh and I don't think u need the / in front of ad.js. If it's in the same folder then just put "ad.js", if it's in the folder before it put "../ad.js" or if it's in a subfolder put "folder/ad.js". Hope that helped. Otherwise paste the code like I said. :)
/ad.js should take you to the root of the domain
LastActionHero
July 23rd, 2001, 07:05
That's where it's stored.
I still haven't implemented what Lucifer suggested. I'll do it tonite and let you guys know if it worked if it doesnt I'll post the code.
clearjade
July 23rd, 2001, 08:14
But if u put noscript tags inside of script tags, the browser will ignore it because it'll ignore the script tags...and so the javascript disabler won't see anything. Usually I see scripts (eg. counters) that put noscript after the script, not inside of it.
LastActionHero
July 23rd, 2001, 10:58
Thanks everybody it's working now :)
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.