javascript - Get the current field name -


I called the function on the body below and what do I want when I press anything in the text box, Will be told and I want to check the name and execute something. The marking name is doing well in FF and not in IE. Thanks

  & lt; Body bgcolor = "# F2F2F2" OnKeyPress = "return getFieldName (event);" & gt;  

...

  getFieldName function (e) {  

e = E || Window.event; Var key = e.keyCode || E.which, target = e.target || E.srcElement;

This works but target.name is not trappable in IE for example:

If (target.name == 'one') // // We can get here FF and not in IE

}

}

You can know which element triggered the event by looking at e.target property (or e.srcElement for IE):

  GetFieldName function (E) {E = E || Window.event; Var key = e.keyCode || E.which, target = e.target || E.srcElement; Warning (target.name); Return (Key! = 13); }  

Check the example above.

And look at this article:


Comments