![]() |
![]() |
|
|
||
If your forms have a maximum number of characters you can be kind to the user by placing the cursor to the next field once that maximum has been reached. Example uses:
To accomplish it, use the JavaScript onKeyUp() function. When the onKeyUp() function is used as an attribute in a form field tag, the function runs every time a key is released after being pressed. Example: <input type="text" name="year" size="4" onKeyUp="_____"> Replace the underscore with JavaScript code to:
Line length restraints prohibit the JavaScript code from being embedded in this article. A demonstration page is at http://willmaster.com/a/13/pl.pl?art135demo The page demonstrates the first four of the example uses listed at the beginning of this article. Simply view the source code of the page and copy the instructions with the example. All of the JavaScript code is within HTML form tags. Now, if your forms have a maximum number of characters you can be kind to the user by placing the cursor to the next field once that maximum has been reached. By: Will Bontrager Copyright 2002 Bontrager Connection, LLC
| ||