document.onclick settimeout function javascript help -


I have a document. I can not get the right of syntax for the onclic function which I would like to delay.

My original code

   

I tried the following, but that code is incorrect, the function has not been executed and nothing has happened.

  & lt; Script type = "text / javascript" & gt; Document.onclick = setTimeout ("Check", 1000);  

I tried the next set, the function was executed, but there was no delay.

  & lt; Script type = "text / javascript" & gt; SetTimeout (document.onclick = check, 1000);  

TIA

Edit:

The solutions were all good, my problem was that I wanted to get the ID of the element I use the function check for. But after the delay, whatever click was being done, there is no "memory" of it, so the rest of the work is not executed.

  document.onclick = makeDelayedHandler (check, 1000);   

The code that is working (does not work in IE6). // "Handling Time" function handler function "f" by MS "Handlehead" (F, Time) {return function (E) {var ev = e || Window.event; SetTimeout (function () {f (ev);}, time); }; } Function check (e) {var click = (e & amp; e.target) || (Event & amp; event. SrcElement); . . .

Thank you all.

UPDATE: Kenbeck's solution works for IE 6.

<.> window.twotimer = function (e) {if (arguments [1]! = ' Timer ') {// If the' timer 'argument was not passed, // function was called from the event, // it again timer e = window.Evolution || E Var target = e.target || E.srcElement; SetTimeout {Function (counter, target, 'timer'}}, 1000); if (e.stoppropation) e.stopprogication (); e.cancelBubble = true description is false; // if you point to this point If you come on, the E element is clicked on the node // one second before- // puts its body here, the alert is clicked using e for e (e.nodeName + 'id =' + E.getAttribute ('id') + '\ n was clicked one second ago');} Document.onclick = twotimer;

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -