Welcome to WebmasterWorld Guest from 23.22.46.195

Forum Moderators: incrediBILL

IE & JavaScript Overload

How many js calls can you use?

   
3:28 pm on May 20, 2004 (gmt 0)

10+ Year Member



How much javascript can you stuff in without it causing display problems? So far, in one cell, I can get two. Add another and none of it will display. Mozilla browsers don't seem to be affected.

I have first a call to the axs tracking script, then a call to phpadsnew. I would like to have another phpadsnew slot beneath the former.

I understand it's not a good idea to use too much js, I am just trying to make my ad management less of a time-consuming chore.

3:52 pm on May 20, 2004 (gmt 0)

WebmasterWorld Senior Member blobfisk is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Hi DavidT,

I'm a little confused, what do you mean by display problems?

A lot of JS will impact your page size, but unless the JS is doing something visually, it should have no effect...

4:18 pm on May 20, 2004 (gmt 0)

10+ Year Member



Well I have this problem with every site I make, it may be the layout I use. I mean that when there are 'too many' js calls, sometimes it only takes two, in IE 5 when I preview all of the page content beneath the js will not display and you get the little yellow error symbol lower left. If i take out one of the js calls all returns to normal. Html comments also cause a similar problem.
4:28 pm on May 20, 2004 (gmt 0)

WebmasterWorld Senior Member blobfisk is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Looks like an error in one the javascript function that you remove to fix the problem.

If you double click on the JS error flag (the yellow alert in the bottom left corner) you will get the JS Error console - what does it say?

5:11 pm on May 20, 2004 (gmt 0)

10+ Year Member



It says:
Line: 309
Char: 1
Error: Syntax error
Code: 0
URL: my-local-file

Thanks for your help.

5:12 pm on May 20, 2004 (gmt 0)

WebmasterWorld Senior Member blobfisk is a WebmasterWorld Top Contributor of All Time 10+ Year Member



What is line 309 in your local file? (It's generally not exact, so the script line close to that).

Mozilla has a better JS debugger that may be worth using...

5:14 pm on May 20, 2004 (gmt 0)

WebmasterWorld Senior Member txbakers is a WebmasterWorld Top Contributor of All Time 10+ Year Member



the problem is in your code somewhere. You'll need to fine tooth comb through your scripts and see what is causing the error.

Toss in "alert" every step of the way so you can see what you are actually getting for values, versus what you think you are getting.

As far as I know there is no limit to the amount of javascript on a page.

I have some pages where the javascript is actually more code than the HTML!

5:35 pm on May 20, 2004 (gmt 0)

10+ Year Member



Line 309 is where the third js call starts.

The actual scripts should be okay, they are from Google adsense or phpadsnew or axs. I'll keep playing around.

5:26 pm on May 28, 2004 (gmt 0)

10+ Year Member



Weeell I did keep playing around and the problem resolves itself if I remove, from the second instance of phpadsnew code, <!-- //--> which encloses the phpadsnew code or the body of it. I've had this problem before, comments preventing the page content from displaying when there is js on the page.

Does this make sense to anyone? I'm using I.E. 5.01. And secondly are the comments at all necessary for the scripts to function? In there ordinary state the whole bit is:


<script language='JavaScript' type='text/javascript'>
<!--
if (!document.phpAds_used) document.phpAds_used = ',';
phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);

document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
document.write ("http://www.mysite.com/phpadsnew/adjs.php?n=" + phpAds_random);
document.write ("&amp;clientid=1");
document.write ("&amp;exclude=" + document.phpAds_used);
if (document.referer)
document.write ("&amp;referer=" + escape(document.referer));
document.write ("'><" + "/script>");
//-->
</script><noscript><a href='http://www.mysite.com/phpadsnew/adclick.php?n=abdead03'><img src='http://www.mysite.com/phpadsnew/adview.php?clientid=1&amp;n=klsdk00' border='0' alt=''></a></noscript>

I remove <!-- and //-->

Thanks.

10:28 am on May 29, 2004 (gmt 0)

WebmasterWorld Senior Member blobfisk is a WebmasterWorld Top Contributor of All Time 10+ Year Member



You shouldn't really use <!-- and --> in JS code. These are HTML comment tags.

This technique was used in the past to hide scripts from browsers that didn't understand JS, but that is (more or less) not an issue these days.

HTH

 

Featured Threads

Hot Threads This Week

Hot Threads This Month