"Hit" a page every 15 seconds

RoafebesBeems

New Member
Hi,<BR><BR>This sample code was posted by Bill. But the javascript does not seem to work. The keepAlive page is not being hit every 15 seconds. I tried it with IE, Netscape and Firefox. Any help?<BR><BR>Thanks.<BR><BR><BR><BR>--------------------------------------<BR><HTML><BR><BODY onLoad="keepAlive();"><BR><IFRAME ID="ALIVE" HEIGHT=1 WIDTH=1></IFRAME><BR><SCRIPT Language=JavaScript><BR>function keepAlive( )<BR>{<BR> document.getElementById("ALIVE").location.href = http://aspmessageboard.com/archive/index.php/"keepAlive.asp?when=" + escape((new Date()).toString());<BR> setTimeout( "keepAlive( );", 15000 );<BR>}<BR></SCRIPT><BR><BR>... your real page content goes here ...<BR><BR></BODY></HTML><BR>---------------------------------------Put an alert() in to verify that the function's being called every 15 seconds.&nbsp;<BR>No. The function is not being called every 15 seconds.<BR><BR>Thanks.&nbsp;<BR>I am sorry. The function is being called every seconds. I just noticed the function name is spelled in lowercase, I forgot it is case sensitive.<BR><BR>So the problem seems to be in this line, in setting the location of the iframe dynamically.<BR><BR>document.getElementById("alive").location.href = "chatbackground.aspx";<BR><BR>So, knowing that javascript is case sensitive, shouldn't alive be capitalized?<BR><BR>document.getElementById("ALIVE").location.href = "chatbackground.aspx";<BR><BR>Or, what is the element id?<BR><BR>~Scott~<BR>I did use the correct case in my case. For some reason location.href was not working. <BR><BR>I found this page, it was very helpful. It explains all about iframes and how to access and load different pages into the iframe. http://www.quirksmode.org/js/iframe.html<BR>
 
Top