日期:2014-05-16 浏览次数:20334 次
function filterSelect(e) { e = e || window.event; var target = e.srcElement || e.target; if (target && (target.tagName == "TEXTAREA" || (target.tagName == "INPUT" && target.type.toLowerCase() == "text"))) { return true; } return false; } document.body.onselectstart = filterSelect; //仅IE下有效
------解决方案--------------------
我借用下楼上的代码:
function filterSelect(e) { e = e || window.event; var target = e.srcElement || e.target; if (target && (target.tagName == "TEXTAREA" || (target.tagName == "INPUT" && target.type.toLowerCase() == "text"))) { return true; } return false; } window.onload=function(){ var o=document.documentElement?document.documentElement:document.body; var isFF=navigator.userAgent.indexOf("Firefox")>0; if(isFF){o.onmousedown= filterSelect}else{o.onselectstart=filterSelect} }