js:获取选中内容

1  var txt;
2  if(window.getSelection)
3  {
4       txt = window.getSelection().toString();
5  }
6  else
7  {
8       txt = document.selection.createRange().text;
9  }                

 

posted on 2017-02-09 16:14  飞翔吧菜鸟23  阅读(129)  评论(0编辑  收藏  举报