Mega Code Archive

 
Categories / JavaScript Tutorial / Form
 

Reset focus()

The focus() method sets the focus to the Reset button. <html>     <head>     <title> Example of the reset focus method</title>     </head>     <body>     <script language="JavaScript">     <!--     function focusReset(){          document.form1.resetbutton.focus();     }     -->     </script>     <form name="form1">     Enter Name: <input type="text" Name="name" Size=15>     <br>     Enter Phone: <input type="text" Name="phone" Size=10>     <br><br>     <input type="reset" name=resetbutton value=Reset>     <br>     <input type="button" value="Set Focus to Reset" onClick='focusReset()'>     <br>     </form>     </body>     </html>