PDA

View Full Version : Reload Image ever X Seconds Help



rgalgon
06-22-2006, 05:12 PM
I have an image on my site that I want to reload every 60 seconds without reloading the whole page (its a jpg if that matters)

This is what I have for a counter:


var milisec=0
var seconds=10

function countdown(){
if (milisec<=0){
milisec=9
seconds-=1
}
if (seconds<=-1){
milisec=0
seconds = 5
document.getElementById("timed_img").innerHTML="loading...";
//I'm thinking it needs to go here??
}
else
milisec-=1
document.getElementById("clock").value=seconds+"."+milisec
setTimeout("countdown()",100)
}
countdown()

Above the image there's a simple input field for displaying the countdown
that time_img element is just a div surrounding the img tag I want to change

I'm just starting javascript programming (if that wasn't obvious)