JavaScript Reference/Javascript Methods/createTextRange

Материал из Web эксперт
Перейти к: навигация, поиск

"createTextRange()" Example

    
<html>
<body>
<script language="JavaScript">
function function1() {
    var myNode = document.body.createTextRange();
    myNode.text = "text for new text range"; 
}
</script>
<button onclick="function1();">Create text range</button>
</body>
</html>



"createTextRange()" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<body>                          <button>                      |
|                |<input type="button">           <input type="hidden">         |
|                |<input type="password">         <input type="reset">          |
|                |<input type="submit">           <input type="text">           |
|                |<textarea>                                                    |
+----------------+--------------------------------------------------------------+



"createTextRange()" Syntax, Parameters and Note

Note:
Creates a new TextRange object with the text contained by the element.
    
Syntax:
    
document.all.elementID.createTextRange()