JavaScript » Event » srcElement

Syntax:
event.srcElement[ = oObject ]

Sets of retrieves te object that fired the event.

The property is read/write (in I.E. 5.0 and later), and has no default value.

Examples

Code:
<SCRIPT LANGUAGE="JScript">
function selectWord() {
  var oSource = window.event.srcElement;
  if (!oSource.isTextEdit)
    oSource = window.event.srcElement.parentTextEdit;
  if (oSource != null) {
    var oTextRange = oSource.createTextRange();
    oTextRange.moveToElementText(window.event.srcElement);
    oTextRange.collapse();
    oTextRange.expand("word");
    oTextRange.select();
  }
}
</SCRIPT>
Explanation:

This example uses the srcElement property to retrive the parent object, if needed, create the text range, move the original object, and select the first word in the object.