Untitled


SUBMITTED BY: Guest

DATE: Oct. 22, 2013, 6:39 p.m.

FORMAT: Text only

SIZE: 522 Bytes

HITS: 1121

  1. <html>
  2. <head> <title></title>
  3. <script type= "text/javascript">
  4. function replaceSelected() {
  5. var range = document.getSelection().getRangeAt(0);
  6. range.deleteContents();
  7. range.insertNode(document.createTextNode('Test'));
  8. }
  9. </script>
  10. </head>
  11. <body>
  12. <p>This is a paragraph. Highlight any of the text and click the button to replace the highlighted text.</p>
  13. <button onclick="replaceSelected();">Click Me</button>
  14. </body>
  15. </html>

comments powered by Disqus