APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Javascript setTimeout problem

Sun Sep 12 19:48:25 2004 Javascript Referencing: http://www.debsberkshireboutique.com

A neighbor wanted to run Google ads on his website. It's one of these turnkey things that give you an on-line store that you can add products to. It's all PHP and Javascript driven, but it wasn't too hard to find a place to stick the Google code (which is also Javascript).

Unfortunately, the moment we added the Google code, his pages seemed to go nuts. The ads would come up, but then immediately disappear, blink briefly, load again, and so on - you couldn't read the page at all.

The problem was a bit of Javascript:


<script language="JavaScript" type="text/javascript">
        setTimeout ("changePage()", 0);
 

That silly piece of code was causing the reload. For what purpose? Well, probably to make sure that the page gets updated with product changes, but if so, it's pretty silly to do it so frequently. I changed it to

<script language="JavaScript" type="text/javascript">
        setTimeout ("changePage()", 50000);
 

which reloads after 50 seconds - much more reasonable.



Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> -> Javascript setTimeout problem


2 comments



Increase ad revenue 50-250% with Ezoic


More Articles by

Find me on Google+

© Tony Lawrence







Mon Feb 14 19:44:15 2005: 17   anonymous




You should change the 0 to a -1. it should solve the problem.




Mon Feb 14 19:57:48 2005: 18   TonyLawrence

gravatar


But -1 would mean it would never refresh, wouldn't it?




------------------------
Kerio Samepage


Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us





The only thing I'd rather own than Windows is English. Then I'd be able to charge you an upgrade fee every time I add new letters like N and T. (Scott McNealy)

A common and not necessarily apocryphal example portrays a solo practitioner starved for business in a small town. A second lawyer then arrives, and they both prosper. (Deborah L. Rhode)







This post tagged: