Hi Fang,
Thank you for that, however if i needed to allow say for example only letters to be input in a field (including things like backspace, left arrow, right arrow, space) am i right in saying that this is the best way to do it?
var evt = window.event? window.event : e;
var keyCode = window.event? evt.keyCode : (evt.charCode || evt.which);
alert(keyCode)
if ( (keyCode > 64 && keyCode < 91) ||(keyCode > 96 && keyCode < 123) )
{
return true;
}
if(keyCode==0)
{
//check charCode value to see if the key pressed was a left, right arrow or backspace. If it was any of those 3 then also return true
}
EDIT: The problem im having is that if i detect certain keys to allow them (like letters only in the above example) then i need to also account for left and right arrow keys which have a keycode value of 0...
Do you rekon IE would be happy with this?