Retrieves the container object in the document hierarchy that can be used to create a TextRange containing the original object.
Syntax
| JavaScript | |
|---|
Property values
Type: Object
the supported text ranges.
Remarks
The property is an object if the parent exists; otherwise, it is null. For example, the parentTextEdit property of the body is null.
Examples
This 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="JavaScript">
function selectWord()
{
var oSource = window.event.srcElement ;
if (!oSource.isTextEdit)
oSource = oSource.parentTextEdit;
if (oSource != null) {
var oTextRange = oSource.createTextRange();
oTextRange.moveToElementText(window.event.srcElement);
oTextRange.collapse();
oTextRange.expand("word");
oTextRange.select();
}
}
</SCRIPT>
See also
- a
- abbr
- address
- area
- article
- aside
- b
- bdo
- blockQuote
- body
- br
- button
- caption
- cite
- code
- col
- colGroup
- custom
- dd
- del
- div
- dl
- dt
- em
- embed
- fieldSet
- figcaption
- figure
- footer
- form
- head
- header
- hgroup
- hn
- hr
- html
- i
- iframe
- img
- input type=button
- input type=checkbox
- input type=file
- input type=hidden
- input type=image
- input type=password
- input type=radio
- input type=reset
- input type=submit
- input type=text
- ins
- kbd
- label
- legend
- li
- map
- mark
- nav
- object
- ol
- optGroup
- option
- p
- pre
- q
- rt
- ruby
- s
- samp
- section
- select
- small
- span
- strong
- sub
- sup
- table
- tBody
- td
- textArea
- tFoot
- th
- tHead
- tr
- u
- ul
- var
Build date: 11/28/2012