Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jul 16th, 2013  |  syntax: None  |  size: 1.65 KB  |  views: 26  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. javascript:var t;try {t=((window.getSelection&&window.getSelection())||(document.getSelection&&document.getSelection())||(document.selection&&document.selection.createRange&&document.selection.createRange().text));}catch(e){t="";}alert(t);
  2.        
  3. javascript:
  4.       var t;
  5.       try {
  6.         t=((window.getSelection&&window.getSelection()) || (document.getSelection&&document.getSelection()) || (document.selection&&document.selection.createRange&&document.selection.createRange().text));
  7.       }catch(e)
  8.       {
  9.         t="";
  10.       }
  11.       alert(t);
  12.        
  13. function getSelectionHtml() {
  14.     var html = "";
  15.     if (typeof window.getSelection != "undefined") {
  16.         var sel = window.getSelection();
  17.         if (sel.rangeCount) {
  18.             var container = document.createElement("div");
  19.             for (var i = 0, len = sel.rangeCount; i < len; ++i) {
  20.                 container.appendChild(sel.getRangeAt(i).cloneContents());
  21.             }
  22.             html = container.innerHTML;
  23.         }
  24.     } else if (typeof document.selection != "undefined") {
  25.         if (document.selection.type == "Text") {
  26.             html = document.selection.createRange().htmlText;
  27.         }
  28.     }
  29.     return html;
  30. }
  31.        
  32. javascript:(function(){var h="",s,g,c,i;if(window.getSelection){s=window.getSelection();if(s.rangeCount){c=document.createElement("div");for(i=0;i<s.rangeCount;++i){c.appendChild(s.getRangeAt(i).cloneContents());}h=c.innerHTML}}else if((s=document.selection)&&s.type=="Text"){h=s.createRange().htmlText;}alert(h);})()
  33.        
  34. javascript:(function()%7Bvar%20node%3Ddocument.createElement('div')%3Bnode.appendChild(getSelection().getRangeAt(0).cloneContents())%3Balert(node.innerHTML)%3B%7D)()%3B
clone this paste RAW Paste Data