javascript - How to redirect to another page after 2 clicks? -
i have question javascript. is:
when click first click anywhere in website, code executed
<a href="#" id="btn"></a> when click secondary click anywhere in website, redirect page.
how ?
thank ! sorry poor english , programmer !
put in page:
<script type="text/javascript"> window.onload = function() { counter = 0; document.body.onclick = function() { counter++; if(counter == 1) { document.getelementbyid('btn').click(); } else if(counter == 2) { location.replace('http://www.google.com'); } }; document.getelementbyid('btn').onclick = function(e) { e.stoppropogation(); alert('link has been clicked!'); }; } </script> sorry, unable create fiddle this, jsfiddle prevents iframe page redirects out of domain.
Comments
Post a Comment