Hi Kathy (I note that Catherine starts with C),
If I understand you right, you are talking about
<a href="somedoc.htm" onMouseOver="mouseEvent(this,event);"
onMouseOut="mouseEvent(this,event);">some link text</a>
<SCRIPT type="text/javascript"><!--
function mouseEvent(elementObject, evt) {
var e = evt || window.event;
if (e.type == "mouseover") { // double check capitalization
doSomething();
} else if(e.type=="mouseout") { // again, whatever...
doSomethingElse();
}
}
// --></SCRIPT>
There have been several detailed discussions about these
types of events in the last few weeks. Perhaps do a google
search (in the groups tab) on
"Csaba Gabor" onmouseover
In particular, I recommend the two responses by
Lasse Reichstein Nielsen in the
..onmouseover=... syntax question re NN events
thread in this (comp.lang.javascript) newsgroup as being
an excellent, detailed coverage.
Csaba Gabor from New York
PS. The this / elementObject are not required in the code above.
I left them in to show the structure. Another way (shown in the
google examples) is with e.target || e.srcElement (but this is not
necessarily the same as what you get with this. For example,
if you mouse over #text in a TD with the TD's onmouseover
set, the tartget will be the #text but the elementObject (this)
will give you the TD).
"Catherine Lynn Smith" <kl*****@hotmail.com> wrote in message news:5f**************************@posting.google.c om...
I'm looking through the client side javascript reference and there's
some mighty useful information in here, but it is not very specific on
'reading' information from event handlers.
In the interest of streamlining my scripting, I was thinking I could
write multi-purpose functions to handle mouseOver and mouseOut events.
Thus far, I am manually passing if it is an Over or Out event, but it
occurs to me that there might be a way to read status of an event
somewhere. Alas, the web is so full of 'simple' mouseOver and
mouseOut handling, I have not as of yet refined a search enough to get
to the information I need.
I tried just doing a test against the element event [
if(elementObject.onmouseover) { doThis(); } ] but that does not seem
to work. What I am looking for is something like:
<a href="somedoc.htm" onMouseOver="mouseEvent(this);"
onMouseOut="mouseEvent(this);">some link text</a>
<SCRIPT language="javascript"><!--
function mouseEvent(elementObject) {
if(elementObject.onmouseover) { // or whatever syntax to test
doSomething();
} else if(elementObject.onmouseout) { // again, whatever...
doSomethingElse();
}
}
// --></SCRIPT>
Thanks in advance for any help!
Kathy Lynn