页面选中文字的javascript

var funGetSelectTxt = function() {
var txt = "";
if(document.selection) {
txt = document.selection.createRange().text; // IE
} else {
txt = document.getSelection();
}
return txt.toString();
};



参考:

  1.http://www.zhangxinxu.com/wordpress/?p=1428

  2.http://www.ryanbay.com/?p=198

posted @ 2011-02-28 09:01  z s k  阅读(196)  评论(0编辑  收藏  举报