Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

srcElement property

Sets or retrieves the object that fired the event. For the standards based property see srcElement.

Syntax

JavaScript

p = object.srcElement

 

Property values

Type: Object

the event that fired.

Remarks

The property is read-only in Microsoft Internet Explorer 4.0, and read/write in Microsoft Internet Explorer 5 and later.

Examples

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


<script>
  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>

See also

event

 

 

Show:
© 2014 Microsoft