faqts : Computers : Programming : Languages : JavaScript : Forms

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

6 of 9 people (67%) answered Yes
Recently 6 of 9 people (67%) answered Yes

Entry

Is there a way we can capture the name or id of a field on an event change like onFocus

Feb 23rd, 2005 00:12
jsWalter, Joe Bloggs, Russ Locke, Feroze Qasim,


Simply assign and ID to the form element and in the event call... 
use 'this.id'...  'this' is a reserved word referring to the 
containing object.
<input type='text' id='firstname' onfocus='alert(this.id);'>
=========
[removed Joes spam]