How to convert enter key with tab key functionality in onkeyup event

Discussion in 'Web Design, HTML And CSS' started by rekha, Feb 29, 2008.

  1. rekha

    rekha New Member

    Joined:
    Jan 17, 2008
    Messages:
    83
    Likes Received:
    0
    Trophy Points:
    0
    Hi

    I have a form In that form when i press enter key in first field it will go to second field and could not submit the form.How can i do this?



    Regards
    Rekha
     
  2. rekha

    rekha New Member

    Joined:
    Jan 17, 2008
    Messages:
    83
    Likes Received:
    0
    Trophy Points:
    0
    Hi

    Any answers.......I need quickly.



    Regards
    Rekha
     
  3. rekha

    rekha New Member

    Joined:
    Jan 17, 2008
    Messages:
    83
    Likes Received:
    0
    Trophy Points:
    0
    Hi

    Nobody knows the solution for this ah.........



    Regards
    Rekha
     
  4. aisha.ansari84

    aisha.ansari84 New Member

    Joined:
    Feb 13, 2008
    Messages:
    82
    Likes Received:
    1
    Trophy Points:
    0
    you are wrong rekha there are experts in this form and they will surely solve your problem
     
  5. rekha

    rekha New Member

    Joined:
    Jan 17, 2008
    Messages:
    83
    Likes Received:
    0
    Trophy Points:
    0
    Hi

    I didn't mean in that way.I want to solve this quickly.If anybody knows the solution for this pls answer me quickly.



    Regards
    Rekha
     
  6. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    HTML:
    <script>
    function handleEnter(e)
    {
    	var characterCode;
    	if(e && e.which)
    	{
    		e = e;
    		characterCode = e.which;
    	} 
    	else 
    	{
    		e = event;
    		characterCode = e.keyCode;
    	}
    
    	if(characterCode == 13)
    	{
    		document.getElementById('nextfield').focus();
    		return false;
    	} 
    	else
    	{
    		return true;
    	}
    }
     </script>
     <input type="text" id="firstfield" onkeypress="return handleEnter(event);" />
     <input type="text" id="nextfield" />
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice