I have a combination of Javascript and ASP on our website. We use Javascript to set a cookie and then ASP to retrieve that cookie in order to display the correct size blowup images to everyone on the web site depending on their resolution. Is there some rule in JavaScript that I don't know about that limits to how many script tags you can have? And if you have too many then your .js file won't work?? This has been working for about 2 years now and all of a sudden it will not work unless I go move the .js file around in the code... It is the weirdest thing. Here is the web site: www.worldfamousgiftbaskets.net Go there, click on any category View the source code: You should see the following lines (with your resolution in it): <!-- Your screen resolution = 1920x1200<br> Actual browser window size = 1896x1024 --> <script language="javascript" src="screen_size_tracker.js"></script> Code (markup): Now, I do have the following Javascript above it: <script type="text/javascript"> <!-- var blowupfocus; function blowpop(urlblw,name1) { blowupfocus=window.open(urlblw,name1,'menubar=no,toolbar=no,location=no,status=yes,directories=no,copyhistory=no,resizable=yes,scrollbars=yes,fullscreen=no'); if (document.all){ blowupfocus.moveTo(0,0) blowupfocus.resizeTo(screen.width,screen.height) } if (window.focus) {blowupfocus.focus()} } var dimensionfocus; function dimpop(urldim,name2) { dimensionfocus=window.open(urldim,name2,'width=700,height=560,menubar=No,toolbar=no,location=no,status=yes,directories=no,copyhistory=no,resizable=yes,scrollbars=yes,fullscreen=No'); if (document.all){ dimensionfocus.moveTo(250,300) } if (window.focus) {dimensionfocus.focus()} } var tafocus; function blowtaf(urltaf,name3) { tafocus=window.open(urltaf,name3,'width=300,height=260,menubar=No,toolbar=no,location=no,status=yes,directories=no,copyhistory=no,resizable=yes,scrollbars=no,fullscreen=No'); if (document.all){ tafocus.moveTo(250,300) } if (window.focus) {tafocus.focus()} } var custfocus; function blowcust(urlcust,name4) { custfocus=window.open(urlcust,name4,'width=420,height=680,menubar=No,toolbar=no,location=no,status=yes,directories=no,copyhistory=no,resizable=yes,scrollbars=yes,fullscreen=No'); if (document.all){ custfocus.moveTo(250,300) } if (window.focus) {custfocus.focus()} } // --> </script> Code (markup): And the following JavaScript below it <script language="javascript" type="text/javascript"> <!-- Hide script from older browsers function toggleRadio(thisField,thisValue) { radioSet = eval("document.products."+thisField) for (i=0;i<radioSet.length;i++) { if (radioSet[i].value == thisValue) radioSet[i].checked = true } } // End hiding script --> </script> Code (markup): Does that matter? All of a sudden, for no reason at all. The cookie will stop writing to someone's computer unless I physically go into the code and move the: <script language="javascript" src="screen_size_tracker.js"></script> Code (markup): above the header (which then displays your resolutions onto the screen) go click on a another picture, then go back into the code and move it back down below the body tag. Then all of a sudden it will start working again for a little while and then bam it stops working. Nothing else is being done. Has anyone ever heard of this? Do I have too much JavaScript going on? Can anyone offer ideas to help fix this issue short of writing a script that will automatically rewrite the header for everyone that comes to the web site... lol Thanks for any advice,
Well, I moved all of my JavaScript in between the header tags and everything seems to be working with no issues now. I don't understand what the difference is whether I set a cookie in the body tag or the header tag... but apparently there is one. It has been figured out.
Possibly because cookies are headers... so they must be in head tag, before the actual content of page loads.