|
|
If onKeyPress
| this code | produces this |
<INPUT onKeyPress="return false"> |
Notice that the attribute starts with the word "return" which means that the rest of the statement is returned to the field object, canceling or allowing the event. Of course, it usually doesn't make sense to just never allow any typing, so you'll usually want to test if something is true or false. For example, you can only type in these fields if the Engineering checkbox is checked:
<INPUT TYPE=CHECKBOX NAME="engr"> Engineering<BR> College: <INPUT NAME="college" onKeyPress="return this.form.engr.checked"><BR> Focus: <INPUT NAME="focus" onKeyPress="return this.form.engr.checked">
Which gives us this form:
Sometimes you want to allow or cancel the event based on which key was pressed. We show how to check which key was pressed in the next page.|
Recommended Resources |
|||
| web hosting tutorials Credit Help |
Search the Internet Search Engine Help |
Low Fat Lifestyle Internet Traffic |
Web
Hosting Web Design |
|
Discount
Hotel Reservations All
Rights Reserved, Copyright © Free-HTML-Tutorials.com 2003 |
|||