Hi VK, thanks for the fast response.
I have a function that is called onMouseDown and I want to know when the
user types a quote, even if not currently in a text editing element.
I can detect that a key has been pressed and can, of course, get the keyCode
and whether shift was pressed. I don't seem to be able to get the ASCII
code, which -- as you point out -- is exactly what I want.
Here's the code:
document.onkeydown = keyIsDown;
function keyIsDown(e){
if(!e)
e = window.event;
window.status = "key down: " + String.fromCharCode(e.keycode) + " ( " +
e.keyCode + ")";
}
If I press '2' , I get 2 (50); if I press '"', I also get 2 (50).
Please tell me I'm missing something simple!
Cheers...
Chris.
"VK" <sc**********@yahoo.com> wrote in message
news:41***********************@news.freenet.de...
I'm missing the root of your problem.
" (double quote) has ASCII-ISO code 34 (hex 22), and this fact has nothing
to do with the current keyboard layout. The same for the rest of ASCII
table (low 127 chars).
What is your actual aim?