krautinator
11-14-2003, 09:53 AM
Does anyone know how to work with setInterval()?
I don't really know how to use that method...
here's what I want to do:
I have this code:
<script>
if(document.all && newdirection < 100){
function changedirection(newdirection){
newdirection += 10
document.all.fading.style.filter="alpha(finishOpacity="+newdirection+",style=3)"
setTimeout ("changedirection(" +newdirection+ ")", 10)
}
}
function changedirectionback(newdirection) {
if(document.all && newdirection > -100){
newdirection -= 10
document.all.fading.style.filter="alpha(finishOpacity="+newdirection+",style=1)"
setTimeout ("changedirectionback(" +newdirection+ ")", 10)
}
}
</script>
I want the two highlighted functions to run continuously while the user is there, the functions just change the finishOpacity of an image, to make it look like a sort of "light energy" is running across it
here's the whole thing put together (I temporarily called the function in the body onLoad event, so you might have to look real close to notice the change...):
http://www.geocities.com/krautinator2001//fadetest.html
the other function just moves the finishOpacity back
I want to call them both about every 1 or 2 seconds
Any help would be appreciated :cool:
I don't really know how to use that method...
here's what I want to do:
I have this code:
<script>
if(document.all && newdirection < 100){
function changedirection(newdirection){
newdirection += 10
document.all.fading.style.filter="alpha(finishOpacity="+newdirection+",style=3)"
setTimeout ("changedirection(" +newdirection+ ")", 10)
}
}
function changedirectionback(newdirection) {
if(document.all && newdirection > -100){
newdirection -= 10
document.all.fading.style.filter="alpha(finishOpacity="+newdirection+",style=1)"
setTimeout ("changedirectionback(" +newdirection+ ")", 10)
}
}
</script>
I want the two highlighted functions to run continuously while the user is there, the functions just change the finishOpacity of an image, to make it look like a sort of "light energy" is running across it
here's the whole thing put together (I temporarily called the function in the body onLoad event, so you might have to look real close to notice the change...):
http://www.geocities.com/krautinator2001//fadetest.html
the other function just moves the finishOpacity back
I want to call them both about every 1 or 2 seconds
Any help would be appreciated :cool: