NGTLD
asked on
Javascript display image for 5 seconds and then hide
Title says it all, I want to display an image for 5 seconds and then have it disappear. I have some banner rotation scripts, but I just want this to show up once.
ASKER
not sure why, but it is not working for me
My bad - I got the timeout arguments mixed up and forgot some quotes...
<script>
function doHide(){
document.getElementById( "imgToHide" ).style.display = "none" ;
}
function hideImage(){
// 5000 = 5 seconds
setTimeout( "doHide()", 5000 ) ;
}
</script>
please post your code.
ASKER
Still nothing
ASKER
I am using the code posted above
\
\
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If that doesn't work, then change the above code to include your image by putting your image inside the <div> </div> tags and see if that helps.
If that doesn't work, check that you have Javascript enabled. :)
If that doesn't work, check that you have Javascript enabled. :)
ASKER
THat did it thanks
You're welcome. :) Thanks for the points.
First, give the image an id... <img id="imgToHide"... />
Then set a function to start when the body loads...
<body onload="javascript:hideIma
And the function is below:
Open in new window