You are here: irt.org | About | Feedback | 5221 [ previous next ]
Feedback on:
irt.org FAQ Knowledge Base Q1657
Sent by
Thomas on Friday February 29, 2008 at 13:49:48
Worth:
Very worth reading
Length:
Technical:
Comments:
This script worked perfectly for me. I had a different situation though where i needed two images refreshed. I tried duplicating the code and changing variable names which did not work but in the end i figured out that to add an extra image all you need to do is duplicate this line:
document.images['myCam'].src = 'myCam.gif?' + Math.random();
in the script at the top you just hit enter at the end of that line and hit enter and make another copy of the line. In the script make the document.images['variable'] different for each one and do the same in the <img src="" width="" height="" name="uniique name here"
so in the end to have more than one image add that line for each additional image. Here is an example of the whole page of a two image refresh:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Weather</title>
<script language="JavaScript"><!--
function refreshIt() {
if (!document.images) return;
document.images['Image1Var'].src = 'Image1.jpg?' + Math.random();
document.images['Image2Var'].src = 'Image2.jpg?' + Math.random();
setTimeout('refreshIt()',5000); // refresh every 5 secs
}
//--></script>
<body onLoad=" setTimeout('refreshIt()',5000)">
<img src="Image1.jpg" width="400" height="300" alt="Image1" name="Image1Var" />
<img src="Image2.jpg" width="400" height="300" alt="Image2" name="Image2Var" />
</body>
</html>
Other feedback on 'irt.org FAQ Knowledge Base Q1657' - show all