Full version: jsB@nk » Form » First Form Field
URL: https://www.javascriptbank.com/first-form-field.html
This JavaScript places the cursor in the first field of a form when the page loads and when the form is reset or cleared. The script works with input types: text, textarea, radio, checkbox, JavaScript password and Select drop-down boxes.
Full version: jsB@nk » Form » First Form Field
URL: https://www.javascriptbank.com/first-form-field.html
<SCRIPT LANGUAGE="JavaScript">// Wayne Nolting ([email protected])<!-- Beginfunction toForm() {document.form.field1.focus();// Replace field1 in the script with the field name of which you want to place the focus.}// End --></script><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<BODY onLoad="toForm()"><FORM NAME="form" METHOD="POST" ACTION="#"><SELECT NAME="field1" SIZE="1"><OPTION VALUE="one">Field 1<OPTION VALUE="two">also field1</SELECT><BR><INPUT TYPE="TEXT" NAME="field2" SIZE="10"> Field 2<BR><INPUT TYPE="TEXT" NAME="field3" SIZE="10"> Field 3<BR><BR><INPUT TYPE="SUBMIT" NAME="submit" VALUE="Submit"> <INPUT TYPE="RESET" onclick="toForm();"></FORM></BODY><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->