|
-
Aug 17th, 2001, 06:30 AM
#1
refresh image (javascript)
I got some code to refresh a image at certain time intervals, but it dosent seam to refresh the picture with the new one??
this is my code ... thanks
Code:
<HTML><BODY>
<!-- visionGS Script Code Begin -->
<SCRIPT language="JavaScript" type="text/javascript">
var t = 5 // interval in seconds
image = "image.jpg" //name of the image
function Start() {
tmp = new Date();
tmp = "?"+tmp.getTime()
document.images["visiongs"].src = image+tmp
setTimeout("Start()", t*1000)
}
</SCRIPT>
<!-- visionGS Script Code End -->
<IMG src=image.jpg border=1 name="visiongs">
</BODY>
</HTML>
-
Aug 17th, 2001, 07:35 AM
#2
Frenzied Member
what i dont understand is:
image+tmp
form what i see it would be something like:
image.jpg?8:31:12
this can't be an image src, or if it can what it does??
-
Aug 17th, 2001, 09:20 AM
#3
more like image.jpg?3412351
its a random number so caching dont cause a problem.
-
Aug 17th, 2001, 10:19 AM
#4
PowerPoster
Here, i made this a while ago. It probably has some stuff you don't need in there, but it gets the job done. 
Tell me if you have any questions.
Code:
<html>
<head>
<title>Ad Cycle</title>
<script language="javascript">
<!--
// Checks for Inetrnet Explorer or Netscape
var IE = (document.all)? 1 : 0;
var NS = (document.layers)? 1: 0;
var i = 0;
var j = 3; // Number of images and URL's used
var tmrSpeed = 1000; // Sets rotation speed
// Array of image sources
var srcarr = new Array(
"img1.gif",
"img2.gif",
"img3.gif"
);
// Array of link URL's
var urlarr = new Array(
"http://www.ask.com",
"http://www.google.com",
"http://www.cnet.com"
);
// Begin main function body
function update(){
if (i >= j) {i = 0};
if (i >= j) {i = 0};
var src = srcarr[i];
var url = urlarr[i];
var hoverText = " "; // Text shown in the window status
// bar on image hover. Note: set
// hoverText equal to "url" without the
// "" to display the url of the current link.
var mouseOver = "window.status='"+hoverText+"';return true;";
var mouseOut = "window.status=' ';";
imglink = '<a href='+url+' onMouseover="'+mouseOver+'" onMouseout="'+mouseOut+'"><img border=0 src='+src+'></a>';
// Write the new link to "obj1"
if (NS) {document.obj1.document.write(imglink);document.obj1.document.close();}
else {obj1.innerHTML = imglink;};
i++;
setTimeout("update()", tmrSpeed);
}
//-->
</script>
</head>
<body onLoad="update()">
<div id="obj1" style="position:absolute">Loading Image Cycle...</div>
</body>
</html>
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
-
Aug 17th, 2001, 10:41 AM
#5
errmm, why are there 3 image paths?!?!
-
Aug 17th, 2001, 11:14 AM
#6
Re: refresh image (javascript)
Originally posted by chenko
Code:
<HTML><BODY>
<!-- visionGS Script Code Begin -->
<SCRIPT language="JavaScript" type="text/javascript">
var t = 5 // interval in seconds
image = "image.jpg" //name of the image
function Start() {
tmp = new Date();
tmp = "?"+tmp.getTime()
document.images["visiongs"].src = image+tmp
setTimeout("Start()", t*1000)
}
</SCRIPT>
<!-- visionGS Script Code End -->
<IMG src=image.jpg border=1 name="visiongs">
</BODY>
</HTML>
would it be because you have the same name for the image.
-
Aug 17th, 2001, 12:16 PM
#7
PowerPoster
Originally posted by chenko
errmm, why are there 3 image paths?!?!
Like i said, i wrote it a long time ago for one of my friends. The part that isin't working in yours,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AUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
-
Aug 17th, 2001, 04:29 PM
#9
Re: Re: refresh image (javascript)
Originally posted by scoutt
would it be because you have the same name for the image.
because the image is updated on the server... It is being used for a web cam, and i dont want to repeatively update the whole page...
the page the code is on is at http://frankhdale.demon.co.uk/cam/default.asp
this is the exact code that came from the visionGS software im using for my webcam.
sebs: thanks, i will try that when im back at work monday, thou i might do it in the week if i can be bothered 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|