📌  相关文章
📜  获取文本选择 javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:12.107000             🧑  作者: Mango

代码示例3
function getSelectionText() {
    var text = "";
    if (window.getSelection) {
        text = window.getSelection().toString();
    } else if (document.selection && document.selection.type != "Control") {
        text = document.selection.createRange().text;
    }
    return text;
}