trying to replace/fix event.toElement

S

stanguru

what is this statement doing?
if (event.toElement && event.toElement.id.slice(0, 7) != "Options")
and how can i replace with a cross-browser functionality? (manyly FF)

its part of a menu, particularly a menuoff function

i am trying to make the menu cross-browser ok, but i dont wanna rewrite
the whole thing, i am figuring out 1 piece at a time

i understand:
it is IE specific and event is only an IE function
the != is done first

function MenuOff (z)
{
var Options;
var Seq;
var i;

if (event.toElement && event.toElement.id.slice(0, 7) !=
"Options")
{
// Get associated menu options (a <div>)
Seq = z.getAttribute("Id").slice(4, 6);
//Options = document.getElementById('Options') + Seq;
Options = document.all["Options" + Seq];

// Hide the menu options
Options.getAttribute("Style").visibility = "hidden";
}
}

TIA
 
A

Alvaro G. Vicario

*** (e-mail address removed) escribió/wrote (22 Aug 2006 07:38:14 -0700):
if (event.toElement && event.toElement.id.slice(0, 7) != "Options")
and how can i replace with a cross-browser functionality? (manyly FF)

If I recall correctly, it's the source element of the event, that is, where
the event generated.

I normally use the addEvent function described here:

http://dean.edwards.name/weblog/2005/10/add-event/
http://dean.edwards.name/weblog/2005/10/add-event2/

I guess the cross browser equivalent would be to assign an event:

addEvent(my_element, 'click', my_function);

And then use "this" inside my_function().
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top