Export (0) Print
Expand All
14 out of 3679 rated this helpful - Rate this topic

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

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.