It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

refresh image source only

refresh image source only

Postby Opaque on Wed Dec 13, 2006 8:11 pm

I would like to refresh the following code only, every 5 seconds.

The code sends a variable to a php script. user=atodd is the variable and must stay in the code.

<img src="is_online/is_online.php?user=atodd"/>

Any help would be greatly appreciated.
Opaque
 
Posts: 0
Joined: Wed Dec 13, 2006 8:02 pm

Postby ngpgeeta on Sun Dec 17, 2006 8:24 am

<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script>
function calling()
{
timer=setTimeout("imgrefresh()",5000)
}
function imgrefresh()
{
g.innerHTML="<img src='one.jpg' width=100 height=300>"
clearTimeout(timer)
}
</script>
</HEAD>

<BODY onload="calling()">
<div id="g"></div>
</BODY>
</HTML>

This will load the image after 5 sec. If you want continous loading of the image, after the line clearTimeout(timer), write calling(). This will again call imgrefresh after every 5 seconds. Take care if you call calling() continously, this may hang your system.
ngpgeeta
 
Posts: 19
Joined: Sat Nov 18, 2006 11:30 am


Who is online

Users browsing this forum: No registered users and 3 guests