TOC PREV NEXT INDEX

domref



relatedTarget


Identifies a secondary target for the event.

Syntax

sTargetObj = event.relatedTarget
 

Parameters

sTargetObj is a reference to an additional event target.

Example

var rel = event.relatedTarget;
 
// dump("LEAVING " + (rel ? rel.localName : "null") + "\n");
 

 
// relatedTarget is null when the titletip is first shown:
 
// a mouseout event fires because the mouse is exiting 
 
// the main window and entering the titletip "window".
 

 
// relatedTarget is also null when the mouse exits the main 
 
// window completely, so count how many times relatedTarget 
 
// was null after titletip is first shown and hide popup
 
// the 2nd time
 
if (!rel) {
 
  ++this._mouseOutCount;
 
  if (this._mouseOutCount > 1)
 
    this.hidePopup();
 
  return;
 
}
 

 
// find out if the node we are entering is one of our 
// anonymous children
 
while (rel) {
 
  if (rel == this)
 
    break;
 
  rel.parentNode;
 
}
 

 
// if the entered node is not a descendant of ours, hide 
 
// the tooltip
 
if (rel != this && this._isMouseOver) {
 
  this.hidePopup();
 
}        
 

 

Notes

From the W3 spec: "Currently this attribute is used with the mouseover event to indicate the EventTarget which the pointing device exited and with the mouseout event to indicate the EventTarget which the pointing device entered."

The example above is typical: the relatedTarget property is used to find the other element, if any, involved in an event. Events like mouseovers are oriented around a certain target, but may also involve a secondary target, such as the target that is exited as the mouseover fires for the primary target.

Specification

relatedTarget
 


Netscape Communications
http://developer.netscape.com
TOC PREV NEXT INDEX