getTarget( event )

This function retrieves the target element of an event and allows you to create reusable JavaScript code.


  • event - the browser's event object


The following functions can be attached to multiple elements' onmouseover and onmouseout events to create a nice hover effect:

function mouseOver(event) { var target = getTarget(event); = "1px dotted blue"; // apply the hover effect } function mouseOut(event) { var target = getTarget(event); = ""; // remove the hover effect }