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

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -