JavaScript Reference/Javascript Objects/TextRange — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 08:22, 26 мая 2010
Содержание
"TextRange" Example
<html>
<head>
<script language="javascript">
function displayText(){
textRange = document.all.myBody.createTextRange();
textRange.moveToElementText(myP);
var m = textRange.text;
alert(m);
}
</script></head>
<body id="myBody">
<p id="myP">This is some text in the document inside a p element</p>
<button onclick="displayText();">Display the text range</button>
</body>
</html>
"TextRange" JavaScript Methods
+----------------+--------------------------------------------------------------+
| JavaScript |collapse compareEndPoints |
| Methods |duplicate execCommand |
| |expand findText |
| |getBookmark getBoundingClientRect |
| |getClientRects inRange |
| |isEqual move |
| |moveEnd moveStart |
| |moveToBookmark moveToElementText |
| |moveToPoint parentElement |
| |pasteHTML queryCommandEnabled |
| |queryCommandIndeterm queryCommandState |
| |queryCommandSupported queryCommandValue |
| |scrollIntoView select |
| |setEndPoint |
+----------------+--------------------------------------------------------------+
"TextRange" JavaScript Properties
+----------------+--------------------------------------------------------------+
| JavaScript |boundingHeight boundingLeft |
| Properties |boundingTop boundingWidth |
| |htmlText offsetLeft |
| |offsetTop text |
+----------------+--------------------------------------------------------------+
"TextRange" Syntax and Note
Note:
Access to text created using the createRange() and
createTextRange() methods.
Syntax:
textRangeName = document.all.elementID.createTextRange()
textRangeName = document.selection.createRange()
textNameRange.memberName