We have seen the event ‘onclick’ in the earlier tutorial. Apart from that you can have many other types of events that you can use in your code. Some of them are –
onLoad , onUnload, onFocus, onBlur, onChange, onSubmit, onMouseOver and onMouseOut .
Most of these event types are self-explanatory from their name. You can use onLoad and onUnload to run functions while the page is getting loaded. You may employ onChange to check whether the data entered in a text box is in correct format or not. onSubmit is essentially a validator which you can use when a form is submitted.
You can also make use of onMouseOver and onMouseOut to get some graphical effects.
It is always a good practice that you try and catch all the errors and give user information about the same, so that he knows why a function (which he was expecting) didn’t execute.
The general format for handling this is:
try { //Your code } catch(err) { //Error handlers }




Join Techblog
Facebook Group
Read
Digg entries
Add techblog to
Google reader