On Key Press
Chapter - 13 : On Mouse & On Key Commands (On Key Press): (Page 5/5)
(Cotinued from previous page)
13.7- On Unload Event:
This event occurs when a user exits a page. In some Browser this event occur when the page is exit and in some when the complete site is closed. This is also defined with the 'body' tag.
<body onunload=window.open(http://www.yoursite.com/thankyou.html);self.blur();>
This will open a web page thankyou.html on exit.
13.8- On Key Press:
This event occurs when any key is pressed. Like mouse click this is also a combination of 'on key down' and 'on key up'.
onkeypress='somefunction()'
onkeydown='somefunction1()'
onkeyup='somefunction2()'
This is mostly used with dynamic script like javascript. In the above example soomefunction(),soomefunction1() and soomefunction2() are different events.
©
funandhobby.com (On Key Press)