To access the form elements the user either clicks the mouse or uses the tab key. You can give your visitors a direct keyboard access by using access key attribute. This attribute specifies the character that you assign to the form element as a particular hot key. When the key is pressed together with the “alt” key, the corresponding form element gets activated.
When assigning characters for access key, always be careful that they do not override the browser’s own access keys. Also function keys (Fl-F12) cannot be made access keys, as they have already been assigned a function. Otherwise the access key defined by you will get preference over the browser’s access key.
The following code will assign access keys to different fields of our sample form and these can be accessed using “Alt” key combination.
<html> <head><titie> text fieids</titie></head> <body bgcolor="pink"> <p align ="center"><b>admission form</b> <form> <p> <input type ="text” name="name" value="enter your name:" size="25" maxlength="30" accesskey="n"> <u>n</u>ame<br><br> <input type ="password" name="passwd" size="25" maxlength="30" accesskey="p"> <u>p</u>password<br><br> <input type ="text" name="address" size="25" maxlength="30" accesskey="a"> <u>a</u>address<br><br> <input type ="radio" name="sex" value="male" accesskey="m" checked><u>m</u>ale<br> <input type ="radio" name="sex" value="female" accesskey="f"> <u>f</u>female<br> </form> </body> </html>