RSS

Attaching functions to events

Thu, Jul 24, 2008

Code, JavaScript

The following is a small list that describes how to attach event handlers to html objects using the document object model separating code from content.
Onload

window.onload = function()
{
:::script:::
}

OnMouseOver

var contentDiv = document.getElementById('content');
contentDiv.onmouseover = function()
{
:::script:::
}

Similarly OnMouseOut

contentDiv.onmouseout= function()
{
:::script:::
}
Share and Enjoy:
  • Facebook
  • Twitter
  • MySpace
  • Digg
  • del.icio.us
  • Google Bookmarks
  • Yahoo! Buzz
,

Comments are closed.