I have javascript
function and that should be called after 3 seconds of complete page load. I know about setIntervel
but it repeat execution after certain time interval. I want it to execute once. Is it even possible?
The onload event fires at the end of the document loading process. At this point, all of the objects in the document are in the DOM, and all the images, scripts, links and sub-frames have finished loading, After
onload
you can usesetTimeout
to delay your function execution..
var myFunc = function() {
alert('After 3 seconds of page load!');
}
window.onload = function() {
setTimeout(myFunc, 3000);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With