Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Aug 2002
    Location
    Oregon, United States of America
    Posts
    882
    Thanks
    1
    Thanked 9 Times in 9 Posts

    Key Event Detection plus Shift

    Code:
    function doSomething(e) {
    	var code;
    	if (!e) var e = window.event;
    	if (e.keyCode) code = e.keyCode;
    	else if (e.which) code = e.which;
    	var character = String.fromCharCode(code);
    	alert('Character was ' + character);
    }
    http://www.quirksmode.org/js/events_properties.html

    This function allows me to see what key was pressed. However, what I want to do, is get the character, not the key. What I mean, is that if you type 3 you get a character of 3. If you type #, (Shift+3) then you also get 3.

    I want to get the character that was entered. How do I do this?
    Thank you for the help.
    If I'm postin here, I NEED YOUR HELP!!

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,919
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    Have a look at this:-

    KeyCodes & Events


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •