Focus OnLoad in JavaScript

You can put the user's cursor inside a text box or put focus on select box as soon as your page is loaded. This helps ensure that visitors do not 'overlook' an important form item on your site and this snippet only uses one line of code!

[View All Snippets]
Show Plain Text »
  1. <!-- This part goes into your body tag -->
  2. <body OnLoad="document.myform.user.focus();">
  3.  
  4. <!-- You you just use the name of the form and field name within your form -->
  5. <form name="myform">
  6. Name:  <input type="text" name="user" size="10">
  7. Email:  <input type="text" name="email" size="10">
  8. </form>
  9.  
  10. </body>
Create Your Free Account
Please remember that this information is essential to use our services correctly.
After creating the account you will be able to download all of our FREE products.
Fields marked with * are mandatory






Please send me information about updates, new products, specials and discounts from ApPHP!
We recommend that your password should be at least 6 characters long and should be different from your username/email. Please use only letters of the English alphabet to enter your name.

Your e-mail address must be valid. We use e-mail for communication purposes (order notifications, etc). Therefore, it is essential to provide a valid e-mail address to be able to use our services correctly.

All your private data is confidential. We will never sell, exchange or market it in any way. Please refer to Privacy Policy.

By clicking "Create Account", you are indicating that you have read and agree to the ApPHP Terms & Conditions.