mouseout example


HTML document 

<html>

<head>
<title>example</title>
<SCRIPT>
function diputreeOnMouseout() {
 var diputree = parent.frames["diputree"].document.diputree;

 // event
 var docElement = "#/1";
 var pEvent = "#xpointer(hasevent/*)";
 var event = diputree.lookup (docElement, pEvent);

 // source
 var pSourceURI = diputree.lookup(event,"#xpointer(hassource/uri/s)");

 if ( pSourceURI=="" ) {
  document.outputForm.sourceField.value = "diputree";
  document.outputForm.locationField.value = "leaving";
 } else {
  var pSource = diputree.getValue( pSourceURI );
  var source = diputree.lookup(docElement, pSource);

  // source text
  var pText = diputree.lookup(source,"#xpointer(lt)");
  var text = diputree.getValue( pText );
  document.outputForm.sourceField.value = text;

  // location
  var pLocation = diputree.lookup(event,"#xpointer(haslocation/*)");
  var location = diputree.getName(pLocation);
  document.outputForm.locationField.value = location;
}

}
</SCRIPT>
</head>

<body>

<form name="outputForm" id="outputForm">
<p>source:
<P><input type="text" name="sourceField" id="sourceField">
<p>location:
<P><input type="text" name="locationField" id="locationField">
</form>

</body>
</html>

Explanation

The event that occurred, this will be a mouseout event because we only listen for mouseout events.

 // event
 var docElement = "#/1";
 var pEvent = "#xpointer(hasevent/*)";
 var event = diputree.lookup (docElement, pEvent);

The source of the event, this will the node from where we moved out or nothing when the mouseout occurred on diputree itself.

 // source
  var pSourceURI = diputree.lookup(event,"#xpointer(hassource/uri/s)");

  if ( pSourceURI=="" ) {
  document.outputForm.sourceField.value = "diputree";
  document.outputForm.locationField.value = "entering";
  } else {
  var pSource = diputree.getValue( pSourceURI );
  var source = diputree.lookup(docElement, pSource);

The text of the node from where the mouse moved out, if there was a source.

  // source text
  var pText = diputree.lookup(source,"#xpointer(lt)");
  var text = diputree.getValue( pText );
  document.outputForm.sourceField.value = text;

The location from where the mouse moved out, if there was a source. This can be handle, icon or label.

  // location
  var pLocation = diputree.lookup(event,"#xpointer(haslocation/*)");
  var location = diputree.getName(pLocation);
  document.outputForm.locationField.value = location;


diputree documentation © 2000 dipu