|
↑
Forms >>>
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.
Add the below code to the <body> section of your page:
<script
language="javascript"
type="text/javascript">
function
toForm()
{
document.form.field1.selectedIndex=0;
document.form.field2.value="";
document.form.field3.value="";
}
window.onload=toForm;
</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>
|
→ casino
|