How to make a function delay 5 seconds in javascript -


how make function display after 5 or 6 seconds

    function a() { alert("after 5 seconds"); }  a(); 

you can use js timers want.

settimeout/setinterval, etc.

var duration = 5000; #in ms, miliseconds. 5000 = 5s  function delayedalert() {   window.settimeout(slowalert, 5000); }  function slowalert() {   alert('that slow!'); } 

look more in https://developer.mozilla.org/en-us/add-ons/code_snippets/timers


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -