Browser/JavaScript Interaction

J

James Howe

I have a couple of simple questions concerning the way a browser and
JavaScript interact. First, I have a document with HTML elements, many of
which have some sort of 'onclick' event defined. The 'onclick' invokes
some javascript action. If a user clicks on one place and then quickly
clicks on another, how are the onclick events processed? Does the second
one get processed after the first one finishes, or are they processed
simultaneously? Does the answer to my question above change if the
javascript operation in question consists of code to change the URL of the
current document? For example, I have a couple onclick events which
execute this snippet of JavaScript:

....
function doSomething(url, foo) {
....
document.getElementById(foo).src=url
....
}

How will the browser handle the situation where the user clicks one place
and then another, both of which invoke the 'doSomething' method?

Here's another question, suppose I have an onchange event defined for an
input field, and an onclick event for some buttony thing. If the user
changes something in the input field and then clicks the buttony thing,
which event will get fired first: the onchange or the onclick? Can it
vary or will it always be one and then the other? Is this behavior
defined in a spec somewhere, or is it up to the programmer to decide how
this is handled?

Finally, is there a good reference, book or website, which would give a
good description of the low-level browser/JavaScript interaction?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top