View Full Version : Triggering a pop up after a certain length of time

06-22-2012, 05:56 PM
Hi all,

I'd like to create a pop-up window triggered after a user has been on a page for a certain length of time. Is JavaScript the way to do this? I'm well-versed in HTML and CSS and have a very limited understanding of JavaScript. Excited to learn :)

Any tips or suggestions on how to make this happen would be appreciated. Thanks in advance!

06-22-2012, 06:15 PM
function openNew(){

<body onload="setTimeout('openNew()',x);">
x = number of milliseconds to open new window

06-22-2012, 07:00 PM
Thanks WolfShade! That's looks pretty straightforward.

If I code it so the popup is a div instead of another html page, would i just put the div name where you currently have file.html?

(I'm not at a point yet where I can try this on the site; the answer may easily reveal myself once I plug it in)

06-22-2012, 08:22 PM
A popup has to be another document or file (htm/html/asp/ppt/doc/etc.)

What you are asking sounds more like a modal window, or at the least a hidden div that becomes visible. Slightly different beast.