topical media & game development

talk show tell print

professional-javascript-10-IERangeExample.htm / htm



  <html>
      <head>
          <title>IE Range Example</title>
          <script type="text/javascript">
              function useRanges() {
                  var oRange = document.body.createTextRange();
                  var oP1 = document.getElementById("p1");
                  oRange.moveToElementText(oP1);
                  alert(oRange.htmlText);
              }
          </script>
      </head>
      <body><p id="p1"><b>Hello</b> World</p>
          <input type="button" value="Use Ranges" onclick="useRanges()" />   
          <p><strong>Note:</strong> This example uses Internet Explorer ranges and will only work on Internet Explorer.</p>
       
      </body>
  </html>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.