Hello there,
I am interested in learning about the onclick event and how I can make a function in it and then exit the onclick or stop it running anymore code.
for example: I have:
[CODE]
document.getElementById(element1).onclick = function {
// lots of code in a function for element1’s onclick event.
// a timer is set to do more code soon; but not if the function
// below stops it first…
tempvar1 = setTimeout(dosomecodefunc, 2000);
}
document.getElementById(element1).onclick = function {
// a whole bunch of code that is running.
// some code to tell onclick to stop running
// any code (including any functions, like above)
}
Gah, this is frustrating, because I know there is a clearTimeout(); I don’t want to know that…
what I want to know is; is there something like exit(onclick()); or something.
I am trying to make it easy to explain my question, because in the future I will use the solution for a bigger problem where clearTimeout() would not suffice.
I am only a novice in Javascript, and as such I require help for these things (which may seem simple); but I am capable of researching this further; if I am given a few leads.
The thing I was hoping to achieve from this post was a more understandable answer than what I would find in Javascript Standards or something.
“or something” Score increased to 5000 points.
Congratulations you now have a habit.