views:

93

answers:

3
A: 

ok got it! it is 38! sorry for putting up this question!

sai
+1  A: 

Check if the shift key is down:

//e = Event
(e.shiftKey && e.keyCode === 55) //returns true if Shift-7 is pressed
digitalFresh
hey digital, it is working for me. I will edit my post, and put the code, could you take a look if I am making a mistake.
sai
A: 

Use the keypress event and test directly for the character as follows. Don't mess with key codes: they will vary between different keyboard types and cultures. Character codes won't.

var el = document.getElementById("your_input");

el.onkeypress = function(evt) {
    evt = evt || window.event;
    var charCode = evt.which || evt.keyCode;
    var charStr = String.fromCharCode(charCode);
    if (charStr == "&" || charStr == "_") {
        alert(charStr);
        return false;
    }
};
Tim Down
you are the man!!
sai