event Properties DHTML Events
Retrieves the object that fired the event.
HTML |
N/A |
Script |
[ oObject = ] event.srcElement |
oObject |
Object that fired the event. |
The property is read-only with no default value.
The following example retrieves the parent object ( if needed ), creates the text range, moves to the original object, and selects 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 tRange = oSource.createTextRange ( );
tRange.moveToElementText ( window.event.srcElement );
tRange.collapse ( );
tRange.expand ( "word" );
tRange.select ( );
}
}
</script>
event