Well, I think that the
f-i-r-s-t thing that I would do here is:
get rid of the "in-line statements!"
"An HTML declaration is
no place for 'statements that actually
do something!'"
Instead, those statements ought to be ... at least ... "calling JavaScript subroutines." The environment in which those subroutines operates should have been established
onload. Then, any
onClick, onMouseOver, onMouseOut, etc. directives should merely result in "subroutine or method-calls."
Now, you've established a JavaScript context that can actually be
aware of the global state of the page. In other words,
now it is in a good position to know that, e.g.,
"the mouse must be 'over something,' because I know that I have been informed of a 'mouseOver' event but that I have not yet been informed of 'MouseOut.'" Armed with such knowledge, the JavaScript logic knows whether or not it should actually
do anything, when it is informed of a "MouseClick."
Mind you: "the 'MouseClick' event is
not 'disabled!'" Instead, it is
"ignored." The JavaScript subroutine gets called, but it decides not to do anything in this case, based on its awareness of what has (or, has not ...) happened in the recent past. The key point is ... "now, it has been maneuvered into the
position to know." It ... being a single JavaScript context ... now will receive notification of all three of these events as they occur. Therefore, it will know in each case what
(if anything) to do.