M
Michael Hill
How do I detect the special characters " ' or & when the user pushed
them.
I have this code:
<input type='text' onKeyUp='ck_char(this,event);'>
function ck_char(fld, e)
{
var key = '';
var whichCode = (window.Event) ? e.which : e.keyCode;
key = String.fromCharCode(whichCode); // Get key value from key code
alert(key);
}
Since each one of these special keys also involve pressing the shift
key, the only value I get passed back is the last key pressed, which in
the case of & would always be 7.
What I'd like to do is detect these special characters when they are
entered and go ahead and replace them with an appropriate equivalent.
Mike
them.
I have this code:
<input type='text' onKeyUp='ck_char(this,event);'>
function ck_char(fld, e)
{
var key = '';
var whichCode = (window.Event) ? e.which : e.keyCode;
key = String.fromCharCode(whichCode); // Get key value from key code
alert(key);
}
Since each one of these special keys also involve pressing the shift
key, the only value I get passed back is the last key pressed, which in
the case of & would always be 7.
What I'd like to do is detect these special characters when they are
entered and go ahead and replace them with an appropriate equivalent.
Mike