Javascript selection的兼容性写法描述
发布时间:2023-09-01 14:41:40 所属栏目:教程 来源:
导读:代码如下:
function getSelectedText() { //this function code is borrowed from: http://www.codetoad.com/javascript_get_selected_text.asp
var txt = "";
if (window.getSelection) {
txt = wi
function getSelectedText() { //this function code is borrowed from: http://www.codetoad.com/javascript_get_selected_text.asp
var txt = "";
if (window.getSelection) {
txt = wi
代码如下: function getSelectedText() { //this function code is borrowed from: http://www.codetoad.com/javascript_get_selected_text.asp var txt = ""; if (window.getSelection) { txt = window.getSelection(); } else if (window.document.getSelection) { txt = window.document.getSelection(); } else if (window.document.selection) { txt = window.document.selection.createRange().text; } return txt; } (编辑:聊城站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐