HTML Image Refresh
Tuesday 30th October 2007 at 15:40

Use the code below to refresh an image on a page. I used this on my web cam page instead of refreshing the whole page, which would take longer to load each time.

<html>
<head>
<script language="JavaScript">
function refreshIt() {
    if (!document.images) return;
    document.images['myCam'].src = 'myCam.gif?' + Math.random();
    setTimeout('refreshIt()',5000); // refresh every 5 secs
}
</script>
</head>

<body onLoad=" setTimeout('refreshIt()',5000)">

<img src="myCam.gif" name="myCam">

</body>
</html>

This code was found on http://www.irt.org/.

+
0 Comments   |   Permalink   |
Add your own comment

Use the form below to add a new comment to the blog entry and other comments above.

Visitor Name:
Visitor Comment:
Email Address:

Your email address will NOT be forwarded to any third parties.

 
Visual CAPTCHA
Captcha Image: