文字选取的方法

IE下有些特殊,所以要做if...else...判断

返回的结果是选取的文字的字符串格式

function selectText(){
    if(document.selection){ //ie
        return document.selection.createRange().text;
    }
    else{  //标准
        return window.getSelection().toString();
    }
}
原文地址:https://www.cnblogs.com/zcynine/p/5554558.html