F
Fabian
Is there a way to detect which object currently has the focus in
javascript? "this" comes close, but isnt implemented in netscape.
javascript? "this" comes close, but isnt implemented in netscape.
Is there a way to detect which object currently has the focus in
javascript? "this" comes close, but isnt implemented in netscape.
Fabian said:
Sure it is:
<input id="alpha" onfocus="alert(this.id)">
Lee hu kiteb:
it seems to me that "this" is msie-specific, or at best, differently
implemented. If it wasnt, my existing script would work in netscape.
It looks like "this" doesnt work in netscape in the context of a function;
only in a html tag. How can I detect what object on screen has the focus
when a particular function is being called?
The "this" keyword works in the context of a function, but in
that context, it refers to the window, unless that function
is a function handler. That's true in IE and Netscape.
Lee said:
That last line should begin "is an event handler."
Fabian said:Is there a way to detect which object currently has the focus in
javascript?
"this" comes close, but isnt implemented in netscape.
<snip>function Sho(ref) {
var moo = ref.parentElement.id;
// broken under mozilla
Fabian said:it seems to me that "this" is msie-specific,
or at best, differently implemented. If it wasnt, my existing script
would work in netscape. It looks like "this" doesnt work in netscape in
the context of a function; only in a html tag.
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.