mehran
asked on
Identifying current active element
How can a javascript function identify the current active element in a document?
for instance in the following code what should I put inplace of activeOBJ?
<HTML>
<BODY>
<FORM id="frm" action="something">
<INPUT id="input1">
<INPUT id="input2">
</FORM>
<SCRIPT type="text/javascript">
function handler(e);
{
if (activeOBJ == "input1") {
dosomething();
}
}
document.onkeypress = handler;
</SCRIPT>
</BODY>
</HTML>
for instance in the following code what should I put inplace of activeOBJ?
<HTML>
<BODY>
<FORM id="frm" action="something">
<INPUT id="input1">
<INPUT id="input2">
</FORM>
<SCRIPT type="text/javascript">
function handler(e);
{
if (activeOBJ == "input1") {
dosomething();
}
}
document.onkeypress = handler;
</SCRIPT>
</BODY>
</HTML>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
event.srcElement.name was what I really look for.
Which is e.target.name in Netscape
ASKER
thanks mplungjan, but I asked this question twice, once in html folder and other one in javascript folder.
and I got my answer in the other side(folder).
and I got my answer in the other side(folder).
No problem
it is indeed this and not self, I happened to come across it myself today :)
Michel