aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes How to use the enter key to link Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to use the enter key to link" Watch "How to use the enter key to link" New topic
Author

How to use the enter key to link

sanjib kumar mandal
Greenhorn

Joined: Jul 20, 2005
Posts: 8
Hi All,
I have jsp page called login.jsp where the user can input his userID and Password and a signIn link is given.The user can move the cursor from userId to password by using the tab key and user can also move to the signIn link by using the tab key and then user have to use the enter key to go to the next page.But my problem is if i enter the password after entered the userid and do not use tab key instead use the enter key the control is not going to the signIn link.

Please help me to solve the problem.
The part of code that i have used in jsp page is given below:

<tr class="whitebg">
<td height="25" valign="middle" ><a href="javaScript:goTologinAction()" class="btnlink">Sign in </a></td>

</tr>

Thanks and regards
sanjeev
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30929
    
158

Sanjeev,
You really have a form on that page even though you are using a link for the submission. You can add onSubmit to the form's action and have it call the JavaScript function.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Pratik Lohia
Ranch Hand

Joined: May 05, 2005
Posts: 88
For the password text box, on the event onkeypress, call a method to check wat key has been pressed, and if the key code is 13, you kknow that the enter key is pressed, and then you perform watever action you want.

The sample code,

function enterPressed(){

if (window.event.keyCode==13){
var textValue=document.forms[0].password.value;
validate(textValue)

}else
{
return false;
}

}

html:text name="xyzeeform" property="password"
styleClass="medium" maxlength="18" ON KEY PRESS="enterPressed()"
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to use the enter key to link