document.activeElement for Netscape

P

pink0.pallino

Hi,
i'm looking for an equivalent function for the netscape's family.

I have a link, when I click on this link a new "layer1" appears
Inside layer1 there is a "textbox1" with autocomplete functions
(auto-added spans with values).

_my_link_
|~~~~~~~~~~~~~~~~~~|<---layer1
| [textbox ] |
| |suggest1 | |
| |suggest2 <-|-|--- list of SPANs
| |suggest3 | |
| ~~~~~~~~~~~~~~ |
~~~~~~~~~~~~~~~~~~~

what I'm trying to do is that if I move the focus outside the textbox1
the layer1 disappers, but if I click on one of the SPANs I still have
the layer1 on the screen but not the list of spans..
I hope it's clear enough..
Now, what I need to know is what element of the document has got the
focus when I loose it from the textbox1 (onblur event on textbox1)..
something that let me to decide:
"if the element that has got focus is a span don't remove layer1"
else "remove layer1"

I can do it with
if ( document.activeElement.tagName != "SPAN" )
layer1.style.visibility = 'hidden';

but how to do it for netscape too?
the e.target trick doesn't work (maybe) because the "blur" event
triggers before the new "focus" so, e.target is still the element
that generated the event: textbox1

I searched the web a lot and found nothing, maybe someone can help me
to decide if it's better I found another way (handling onclicks and
onkeypress -for the TAB)

thanks and sorry for the long post.
 

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
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top