Javascript

They have: 10 posts

Joined: Oct 1999

Is there a function that refreshes an img every, say 20 seconds? Or at least a time function that runs a loop every 20 seconds so you can change the img.src?

They have: 62 posts

Joined: Jun 2000

Yes, a script for this can be written, the trick is finding someone to write it for you, though. Smiling

They have: 10 posts

Joined: Oct 1999

You've effectivily wasted my time sir. I asked for a function that pauses a javascript if nothing else. Instead of posting some sort of meaningful reply, you posted a message telling me the script can be writen. Instead of saving me the time of searching though javascript sites for this functions, you have totally defeated my purpose. Not only have you defeated my intended goal, you have wasted server resources and the time of numerous other people who have read this post. Thank you.

If any javascripters know the function, I think it is timeout() or something, please let me know. If you don't have anything helpfull to say, do us all a favore and not waste my time.

They have: 62 posts

Joined: Jun 2000

You said you wanted a "function" - to me that implies something already simply built into JavaScript. I may be wrong, but as far as I know it may not exist.

My post was intended to inform you (I wasn't sure if you knew or not) that it would have to be custom-tailored, and a turnkey function may not be available.

I will say this: your rather lengthy, scathing post probably wasted more of your time than reading my one-sentence comment.

Despite your rude comments, here's hoping you find someone to help you.

They have: 30 posts

Joined: Oct 2000

Hi PDavis,

try adding this to the image tag of the image you want to reload on a timed basis onLoad="setTimeout('history.go(0)',5000)"it appears to work in both browsers. replace my 5000 with the number of miliseconds to wait between refreshes.

Later

CaIslander
From The Land Of SunShine, Surf & Code
WebXpertz Community Forums for Webmasters & Developers

They have: 10 posts

Joined: Oct 1999

that was the function I was looking for Smiling

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

doesn't that script reload the whole page?

They have: 488 posts

Joined: Feb 2000

Max is correct, the script loads the page.

Perhaps this will change the image.

<script>

</script>


Search Engine

The above code switch image every four seconds, change to any time you reguire.

Hope this helps

[Edited by NSS on Dec. 01, 2000 at 01:40 AM]

They have: 10 posts

Joined: Oct 1999

function imgRefresh(){

document.cimage.src = "autosnap.jpg";
}

function change() {
var webcam = new Image();
webcam.src = "autosnap.jpg";
for (x=5000; x<10000000; x=x+5000){
setTimeout('imgRefresh()',x);
}
}

This code works, but it just refreshes the cached image. If I put in an alert or something it will refresh every 5 seconds. Any ideas on how I can get the script to reload the image?

Thank you

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.