When I set event.returnValue to false or return false in the onkeydown event handler,the onkeypress event will be cancelled,which I can't understand.Anyone may explain it ? Thank you very much!!
May be keydown is the first part of keypress action. So if keydown is canceled the keypress will be canceled as well. It would be something like "onclick" = "onmousedown" + "onmouseup"
Hi,Koolman.I don't think so! But because onkeyup event isn't cancelled at all ! ms-help(When we press F1 on the HTML source view of vs2005,it will appears) says as follows: onkeydown Event Information Bubbles Yes Cancels Yes To invoke Press any keyboard key. Default action Returns a number specifying the keyCode of the key that was pressed. ---------------------------------------------------------------------------------------------- onkeypress Event Information Bubbles Yes Cancels Yes To invoke Press any alphanumeric keyboard key. Default action Returns a number specifying the Unicode value of the key that was pressed. -------------------------------------------------------------------------------------------------- onkeyup Event Information Bubbles Yes Cancels No To invoke Release any keyboard key. Default action Returns a number specifying the keyCode of the key that was released. ------------------------------------------------------------------------------------------------- May be keyup cannot be cancelled,so if keydown is cancelled keyup isn't cancelled yet? -------------------------------------------------------------------------------------------------- Thank you for your reply!!!