Converting a CR to a TAB in a Web Page

Illustrates a technique that can be used to allow the ENTER key to navigate between fields on a web page.


Do you users complain about having to use the TAB key to move from field to field on your web page? The code below contains an illustration of a technique that will convert a Carriage Return to a TAB character. Naturally, you can change the pseudo-TAB key by modifying the ASCII value that is part of the test.  

 <SCRIPT language="javascript">
<!-- function TranslateKey(keypress) {
  if ( event.keyCode == 13) { event.keyCode = 9; }
  }
window.document.onkeydown = TranslateKey ;
//-->
</SCRIPT>

You might also like...

Comments

Bruce Johnson I am the owner of a small application development consulting company that specialized in the design and implementation of Internet-based applications. While there are others who can make a web site...

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC. As potential programmers, they are mentally mutilated beyond hope of regeneration.” - E. W. Dijkstra