Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to fill blank in javascript? 1

Status
Not open for further replies.

gchen

Programmer
Nov 14, 2002
174
US
Hi,

how do i fill up the blank in javascript?

i want to do below...

onLoad="document.form1.aaa aa.focus()"

where 'aaa aa' is the field name. i tried aaa%20aa but no luck. i believe there is a way to do it but i just can't remember it.

thanks in advance!!!!!
 
If you give your control an ID (might be same as "name" attribute), you can try this:

<body onload=&quot;javascript:document.getElementById(&quot;aaa aa&quot;).focus();&quot;>
<input type=text id=&quot;aaa aa&quot; name=&quot;aaa aa&quot;>

getElementById works for both Netscape & IE. I tried the getElementByName method but wasn't successful with it.
 
document.form1.elements['aaa aa'].value = 'bob'

...something like that... I may not be remembering perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top