arguments for onmouseover

W

Wim Roffal

I want to set an onmousover function with arguments:

<a id="test" href="test.htm">testje</a>

anchor = document.getElementById("test");
anchor.onmouseover = function(){ anchorMouseover(this,event) };

function anchorMouseover(anchor,event)
{ ...
}

In this code "this" will provide the anchor, but I can't find a way to get
the event. Can anyone give me some suggestions how to do get this?

Thanks a lot...

Wim
 
E

Evertjan.

Wim Roffal wrote on 21 sep 2004 in comp.lang.javascript:
I want to set an onmousover function with arguments:

<a id="test" href="test.htm">testje</a>

anchor = document.getElementById("test");
anchor.onmouseover = function(){ anchorMouseover(this,event) };

function anchorMouseover(anchor,event)
{ ...
}

In this code "this" will provide the anchor, but I can't find a way to
get the event. Can anyone give me some suggestions how to do get this?

Why do you want to specify the event?

You already know [and the code knows] the event is onmouseover.
 
M

Martin Honnen

Wim said:
I want to set an onmousover function with arguments:

<a id="test" href="test.htm">testje</a>

anchor = document.getElementById("test");
anchor.onmouseover = function(){ anchorMouseover(this,event) };

anchor.onmouseover = function (evt) {
if (typeof evt == 'undefined') {
evt = window.event;
}
anchorMouseover(this, evt);
}
should deal with both Mozilla and DOM browsers passing the event as an
argument and with IE and compatible using window.event.
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top