...

View Full Version : how do i make a text field autofocused



emehrkay
12-25-2005, 09:34 PM
im printing a text field to the screen by an onclick event, how would i give that field focus. i just cant figure it out

document.getElementById(eyeD).innerHTML = '<input type="text" name="'+eyeD+'" id="'+eyeD+'_field" value ="'+value+'" onblur="sndReq(\'check_'+eyeD+'\',\''+eyeD+'\');" onfocus="closeTxt(\''+eyeD+'\');" />';

emehrkay
12-27-2005, 12:25 AM
anyone know how?

nikkiH
12-27-2005, 02:25 PM
By calling the focus method of the element.

Generically:
document.getElementById(id).focus()
or
document.formname.elementname.focus()

emehrkay
12-29-2005, 07:23 AM
wow thanks man. im just learning the dom and what can be done with it, that was simple. i <3 DOM



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum