Setting Form Focus

Use the Javascript function: document.form.field.focus() to give the object the focus.

<body onload="document.formname.fieldname.focus()" >

Another way to set focus:
<form name="form1" action="somepage.asp" method="post">
 <input type="text" name="city">
 <input type="submit" value="Submit">
 </form>
 <script language="JavaScript"> document.forms[0].city.focus(); </script>


javascript forms form focus


Back To Top
© 1998 - 2014 psacake.com | My3C's

Version 7.0a | Advertise on this site