- onkeypress occurs when a keyboard key is pressed or held down
- onchange occurs when the content of a field changes
Ok, let's go further. If you want to validate the character number limitation of one textarea control, which one you should choose?
I told you that the onchange is better. Because if you use copy text from somewhere to this control, the onkeypress will not be effected; while, the onchange will be worked well.
And now, I think you can distinguish the two JavaScript events easily.