'TextRange' Example : TextRange : Javascript Objects JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » Javascript Objects » TextRange »

 

'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>

    
      
      



-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Javascript Objects
» TextRange