srcElement property

11 out of 3673 rated this helpful - Rate this topic

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

See also

event

 

 

Send comments about this topic to Microsoft

Build date: 1/23/2013

Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.