- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
function get_selection()
{
selection = "";
if (document.getSelection)
{
selection = document.getSelection();
selection = selection.replace(/\r\n\r\n/gi, "_doublecaret_");
selection = selection.replace(/\r\n/gi, " ");
while(selection.indexOf(" ") != -1)
selection = selection.replace(/ /gi, "");
selection = selection.replace(/_doublecaret_/gi, "\r\n\r\n");
}
else
if (document.selection) { selection = document.selection.createRange().text; }
return selection;
}
istem 11.11.2011 21:43 # 0
bugmenot 11.11.2011 21:52 # +1
пляски с реплейсами фееричны
Lure Of Chaos 11.11.2011 22:11 # +1
actuator 12.11.2011 04:24 # +1
bugmenot 12.11.2011 21:22 # 0
In Navigator 4, this method captures the current text selection in the document. The method is deprecated in Netscape 6 in favor of the window.getSelection( ) method (which returns a sophisticated selection object, rather than just text). Invoking from the document object displays a warning in the JavaScript Console window, but does not throw a full-fledged exception. The IE equivalent is reading the selection property.
Parameters
None.
Returned Value
String.