Submit Your Site For Free!

Email Address:
* URL:
*
*Indicates Mandatory Field

Terms & Conditions

DevWebProAU
FlashNewz
DevWebPro








Javascript SetTimeout Problem

By A.P. Lawrence
Expert Author
Article Date: 2005-02-03

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.

About the Author:
A.P. Lawrence provides SCO Unix and Linux consulting services http://www.pcunix.com




Newsletter Archive | Article Archive | Submit Article | Advertising Information | About Us | Contact

Dev Web Pro AU is an iEntry, Inc.® publication - 1998-2009 All Rights Reserved Privacy Policy and Legal