Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: Enter key same effect as the Tab


Message #1 by "welliton alves toledo" <welliton@r...> on Wed, 24 Jul 2002 14:53:11
How I can do that the Enter key have the same effect as the Tab
key in a webform?
Message #2 by jdonahue@f... on Wed, 24 Jul 2002 16:17:17
You can use a client-side javascript to accomplish this:

function disableEnterKey(){
	if(event.keyCode == 13) 
	   event.keyCode=9 //return the tab key
    event.cancelBubble = true	    
}

then in your html, use the onkeydown="disableEnterKey" as follows:

<input id="whatever" type="text" onkeydown="disableEnterKey()">

Jim

> How I can do that the Enter key have the same effect as the Tab
key in a webform?

  Return to Index