1 var txt; 2 if(window.getSelection) 3 { 4 txt = window.getSelection().toString(); 5 } 6 else 7 { 8 txt = document.selection.createRange().text; 9 }
1 var txt; 2 if(window.getSelection) 3 { 4 txt = window.getSelection().toString(); 5 } 6 else 7 { 8 txt = document.selection.createRange().text; 9 }
转载于:https://www.cnblogs.com/hzp-blog/p/6382621.html