var agt=navigator.userAgent.toLowerCase(); var ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1) && (agt.indexOf("omniweb") == -1)); function a(){ var myArea = document.getElementById("s"); var selection; if (!ie){ if (myArea.selectionStart!= undefined) { selection = myArea.value.substr(myArea.selectionStart, myArea.selectionEnd - myArea.selectionStart); } }else{ if (window.getSelection){ selection = window.getSelection(); }else if (document.getSelection){ selection = document.getSelection(); }else if (document.selection){ selection = document.selection.createRange().text; } } alert(selection) } script> [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
Copyright © 2019- jusc.cn 版权所有
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务