PDA

View Full Version : wait for a click


scroots
08-29-2002, 08:35 PM
in a function how can i detect the next click when the function is running and perform another function. So the function pauses and then continues on the next click e.g.

function dev(){
on.next click = closit;
}}

scroots

joh6nn
08-29-2002, 09:01 PM
in the first function, you take care of all the stuff you want to happen before the next click. then, you just reset the onClick handler for the object you want to be clicked. so:

function firstFunc() {
/* a bunch of stuff */ :
document.getElementById('jimmy').onclick = secondFunc;
}

function secondFunc() {
/* a bunch more stuff */
// if you don't want anything more to happen the next time 'jimmy' is clicked, just set the onclick handler to null;
document.getElementById('jimmy').onclick = null;

}

scroots
08-29-2002, 09:05 PM
i understand you method how would i be able to detect a click anywhere on a page?

scroots

joh6nn
08-29-2002, 09:27 PM
document.onclick