How do I hide a layer with the onLoad event handler?

L

lee

Hello

I need to hide a layer after a set time when the page loads.

Let's say a 1000ms (a second).

Now this works as you'd expect:

<body onLoad="PopUp.style.visibility='hidden';">

Which closes the layer so quick the user cannot see it.
I need it to close after 1 second. I'd thought this would work, but it
does not:

<onLoad="setTimeout('PopUp.style.visibility='hidden';', 1000);">


Does anyone know how to hide the layer after a set time?

Thanks
 
P

pcx99

<onLoad="setTimeout('PopUp.style.visibility='hidden';', 1000);">

<onLoad="setTimeout('PopUp.style.visibility=\'hidden\';', 1000);">

Quotes within quotes within quotes need to be escaped \'
 
N

naixn

pcx99 wrote :
<onLoad="setTimeout('PopUp.style.visibility=\'hidden\';', 1000);">

Quotes within quotes within quotes need to be escaped \'

Just in case :
<onLoad="setTimeout('PopUp.style.display: \'none\';', 1000);">
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top