【发布时间】:2011-06-07 00:47:47
【问题描述】:
如何在没有输入文本区域的情况下阻止文本选择并选择项目 我实际上有可以在 IE 中运行但不能在其他浏览器中运行的脚本,这里是:
var omitformtags=["input", "textarea", "select"]
omitformtags=omitformtags.join("|")
function disableselect(e){
if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
return false
}
function reEnable(){
return true
}
if (typeof document.onselectstart!="undefined")
document.onselectstart=new Function ("return false")
else{
document.onmousedown=disableselect
document.onmouseup=reEnable
}
document.onmousedown=click;
function click()
{
if ((event.button==2) || (event.button==3)) { alert("Yazı Kopyalayamazsınız!");}
}
我需要在其他浏览器中以相同的方式工作,必须有一个现成的脚本,只是在网络中找不到..
【问题讨论】:
-
那么你的问题是什么意思
-
我需要在其他浏览器上以相同的方式阻止这不是很明显吗?
标签: javascript internet-explorer select input textarea