Will Script For Food

Web Scripting Tutorials

About

html, php, actionscript, javascript, ajax, dom, css, mysql, and xml tutorials

The term ‘javascript event handlers’ is a loose term. The more appropriate term would be ‘event handlers’. These event handlers can activate javascript when coded into your HTML. Through the event handlers, you can either code the javascript right into the event handler or call a function from the event handler.

Here’s an example:

onclick=”alert(’clicked on’);” <==========one example (javascript right into the event handler)

onclick=”clicked();” <==========second example (function call in the event handler)

The function for the second example would look something like this:

function clicked(){
alert(’clicked on’);
}

The above function would of course be written into your .js file (referenced in the header of your HTML page) or written between <script type=”text/javascript”>*write function here without the stars*</script> tags in your HTML page.

Here is a list of some possible event handlers:
onabort
onblur
onchange
onclick
ondblclick
onerror
onfocus
onhelp
onkeydown
onkeypress
onkeyup
onload
onmousedown
onmousemove
onmouseout
onmouseover
onmouseup
onmove
onreset
onresize
onsubmit
onunload

And to give credit where credit is due, I snagged this full list from daaq.net. This list and all descriptions of the event handlers, what they apply to, and when to use them are all on this site. Great list guys.

One Response to “Javascript Event Handlers”

  1. xyxyrymu

Leave a Reply