Example 4

This third example will display an alert only if the key that is pressed should not be allowed in the textbox.