javascript custom dialog box with delay -



javascript custom dialog box with delay -

i want popup dialog box , after 5 seconds, want page redirects google.com . therefore, need have delay function settimeout() doesnt work. here code. how can delay 5 seconds before redirect... way, using someone's javascript code display works perfectly.

<a href="javascript:showdialog('error','you have encountered critical error.','error',10);settimeout(window.location.href ='http://google.com', 5000);">error</a>

settimeout works, it's not used correctly. seek this:

javascript

function clickhandle() { showdialog('error','you have encountered critical error.','error',10); settimeout(function () { window.location.href ='http://google.com'; }, 5000); }

html

<a href="clickhandle()">error</a>

the first argument of settimeout code executed (for illustration string evaluated) improve practice avoid eval , utilize callback instead (like in example).

it's not thought set click handler straight in html. suggest utilize onclick example.

javascript

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -