Script Categories













Forms >>> First Form Field.

This script 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, password and Select drop-down boxes.


Field 2
Field 3

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
function toForm() {
document.form.field1.selectedIndex=0;
document.form.field2.value="";
document.form.field3.value="";
// Replace field1 in the script with the field name of which you want to place the focus.
}
window.onload=toForm;
//  End -->
</script>
<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="button" value="RESET" onclick="toForm();">
</FORM>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.



Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).




©