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 - 2024 psacake.com
Version 7.21 | Advertise on this site