How do I make a div popup after 10 seconds or so (using javascript or php)?

Is there a way to make the div pop up in the center of the page 10 seconds after the page has loaded?

0


a source to share


1 answer


You do this with a Javascript function setTimeout

.

The second argument is how long Javascript will wait (in milliseconds) before calling the first argument.



window.onload = function() {
    setTimeout(function() {
        document.getElementById('mydiv').style.display = 'block';
    }, 10000);
}

      

Assuming your DIV has the display: none;

id "mydiv" to run, the above should work.

+3


a source







All Articles