DHTML Object Properties DHTML Objects
Retrieves the next object in the hierarchy that can be used to create a text range that contains the original object.
HTML |
N/A |
Script |
[ oObject = ] object.parentTextEdit |
oObject |
Next object in the hierarchy. |
The property is read-only with no default value.
The property is an object if the parent exists; otherwise, it is null.
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 oTextRange = oSource.createTextRange ( );
oTextRange.moveToElementText ( window.event.srcElement );
oTextRange.collapse ( );
oTextRange.expand ( "word" );
oTextRange.select ( );
}
}
</script>