Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript equivalent for JavaScript image refresh 1

Status
Not open for further replies.

mspope

IS-IT--Management
Aug 19, 2002
123
0
0
US
The following example uses JavaScript to refresh/reload the image every 15 seconds. I'm looking for a VBscript equivalent.

===========================================================
<html>
<body>
<script language="javascript">
var refreshrate=15;
var image=" function refresh(){
document.images["pic1"].src=image+"?"+new Date();
setTimeout('refresh()', refreshrate*1000);
}
if(document.images)window.onload=refresh;
</script>
<img src="'+image+'" id="pic1">
<br>Downtown Winnipeg, Manitoba. Image updates every 15 seconds....
</body>
</html>
===========================================================
 
This is the literal vbs version.
[tt]<html>
<head>
</head>
<body>
<script language="vbscript">
dim refreshrate : refreshrate=15
dim image : image="sub refresh
document.images("pic1").src=image & "?" & Date
setTimeout "refresh",refreshrate*1000
end sub
if not (document.images is nothing) then window.onload=getref("refresh")
</script>
<img src="'+image+'" id="pic1">
<br>Downtown Winnipeg, Manitoba. Image updates every 15 seconds....
</body>
</html>
[/tt]
I know this little clever pearl of a hack. But, I would do it more correctly to my taste.
[tt]
<html>
<head>
<script language="vbscript">
dim refreshrate : refreshrate=15
dim image : image="sub refresh
if not (document.images is nothing) then
document.images("pic1").src=image & "?" & Date
setTimeout "refresh",refreshrate*1000
end if
end sub
window.onload=getref("refresh")
</script>
</head>
<body>
<img src="'+image+'" id="pic1">
<br>Downtown Winnipeg, Manitoba. Image updates every 15 seconds....
</body>
</html>
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top