PDA

View Full Version : autoselected textbox, etc. in form



djr33
05-02-2006, 07:04 AM
this has gotta be easy, and might just be html, not JS.

How does one make a particular text box selected when a page loads, so you can just type, and it'll automatically go in there, rather than just not do a thing because the form/field isn't selected?

Twey
05-02-2006, 07:32 AM
<body onload="document.forms['myform'].elements['mrtextbox'].focus();">
<form name="myform" action="" method="post">
<input type="text" name="mrtextbox">
</form>
</body>

djr33
05-02-2006, 08:48 AM
Thanks.

That's the most compatible/best way?

Twey
05-02-2006, 09:51 AM
The only way, insofar as I know.

djr33
05-02-2006, 07:24 PM
Thanks :)