Начало
Детали страницы
Выделенный текст
Захват любой текст, который был выделен с помощью курсора. В Internet Explorer, он даже хватает текста, выделенного в текстовое поле или текстовое поле.
Highlight any text on the page and JavaScript will 'capture'
it in the textbox below. Internet Explorer also allows for
the capture of text highlighted within a textbox or textarea:
Here's two to try out:
or
or highlight me!
Selected text:
JavaScript Page Details: Выделенный текст
<!-- TWO STEPS TO INSTALL HIGHLIGHTED TEXT: 1. Copy the coding into the HEAD of your HTML document 2. Add the last code into the BODY of your HTML document --> <!-- STEP ONE: Paste this code into the HEAD of your HTML document --> <HEAD> <SCRIPT LANGUAGE="JavaScript"> <! > <! > <!-- Begin var text = ""; function getActiveText(e) { // Sets text MSIE or Netscape active // text based on browser, puts text in form text = (document.all) ? document.selection.createRange().text : document.getSelection(); document.theform.text.value = text; return true; } document.onmouseup = getActiveText; if (!document.all) document.captureEvents(Event.MOUSEUP); // End --> </script> </HEAD> <!-- STEP TWO: Copy this code into the BODY of your HTML document --> <BODY> <center> <form name=theform> Selected text: <input type=text name=text value=""> </form> </center> <!-- Script Size: 1.12 KB -->