Javascript code to make image disapear after a a given period of time

I need a code that will either hide a div or an image after a period of time that i will set probably one second or faster if possible.  basically i just want to flash a picture and then have it dissapear.
LVL 1
hibridassassinAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

quincydudeCommented:
something like setting a timeout and on time out  set the style of the div to hidden
<script language="javascript">
  window.setTimeout("getElementById('xDiv').style.visibility='hidden';", 5000);
</script>

Open in new window

0
hibridassassinAuthor Commented:
so is xVid the name of the div?
0
hibridassassinAuthor Commented:
also, is 5000 seconds?
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

quincydudeCommented:
it should be the id of div, replace it with your own div id and add this to your div by
<div id="mydiv"/> or something like that
0
quincydudeCommented:
5000 means 5 seconds
0
Michel PlungjanIT ExpertCommented:
and please use
document.getElementById for compatibility reasons
0
ZvonkoSystems architectCommented:
For compatibility reasons I would use this one:
<img name="EE" onLoad="setTimeout('document.images.EE.style.display=\'none\';',5000)" src="http://images.experts-exchange.com/images/eeWatermark.png"  >

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Michel PlungjanIT ExpertCommented:
Yeah - that would work too, however I think.style is much younger and compatible from getElementById (at least on non-IE)
document.images['EE']

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.