'moveToElementText()' Example : moveToElementText « Javascript Methods « JavaScript Reference

'moveToElementText()' Example

    
<html>
<body>
<script language="JavaScript">
function function1(){
   var myRange1 = document.body.createTextRange();
   myRange1.moveToElementText(myDiv1);
   myRange1.findText('test');
   myRange1.select(); 
} 
</script>
<div id="myDiv1" style="background-color:blue; width:250; height:200;">Testing</div>
<input type="button" value="MoveToElementText" onclick="function1();">
</body>
</html>

    
      
      








Related examples in the same category

1.'moveToElementText()' Syntax, Parameters and Note
2.'moveToElementText()' is applied to