JS禁止选中文本方法】的更多相关文章

if (typeof(element.onselectstart) != "undefined") { // IE下禁止元素被选取 element.onselectstart = new Function("return false"); } else { // firefox下禁止元素被选取的变通办法 element.onmousedown = new Function("return false"); element.onmouseup =…
document.onselectstart=new Function("event.returnValue=false");//禁止选中(无法复制) document.oncontextmenu=new Function("event.returnValue=false");//取消鼠标右键…
网页内容不能选中.复制应该如何实现呢? 通过css *{ moz-user-select: -moz-none; -moz-user-select: none; -o-user-select:none; -khtml-user-select:none; -webkit-user-select:none; -ms-user-select:none; user-select:none; } 通过body标签 <body οncοntextmenu="return false;" on…
为了防止无良网站的爬虫抓取文章,特此标识,转载请注明文章出处.LaplaceDemon/ShiJiaqi. http://www.cnblogs.com/shijiaqi1066/p/5761818.html 方式一:CSS禁止元素选中. user-select: none; 不允许被选中. user-select:text; 允许被选中. user-select不同浏览器支持不一样,参看下面例子. 例:禁止整个页面的内容被选择 body{ -webkit-touch-callout: none…
使用js禁止用户选中网页上的内容,IE及Chrome下的方法一样.使用onselectstart, 比如: 在body中加入<body onselectstart="return false"> Firefox下,控制css body { -moz-user-select: none; } 这样在IE,Firefox及Chrome下都可以禁止用户选中页面上的内容了.     转载自:http://www.cnblogs.com/top5/archive/2012/04/15…
LayUI这几年比较流行,里面的Table组件也比较强大,但是前面的CheckBox没有禁止选中功能,今天就来试试,看看能不能给添加一个禁止选中功能. Fork LayUI源码 LayUI项目地址 Clone到本地 找到src里面lay下面的modules文件夹里面的table.js 添加字段标记 参照这里我们也添加一个"IS_DISABLE"的标记 添加完如下 config: { checkName: 'LAY_CHECKED', //是否选中状态的字段名 indexName: 'L…
最近在做IM的语音功能,发现当长按录音的时候手机会弹出来系统菜单, IOS下bug形式:1)长按的标签设置为css background的形式:不会弹出菜单: 2)但是当设置为img时,系统默认识别为保存图片的行为,因而会产生以下系统菜单: 3) 当前标签为纯文字时,会弹出选中文字的系统菜单: 安卓的bug形式如下: 1)当设置为css的background形式时候,系统默认对整个网页进行操作,因而产生以下菜单: 2) 当设置为img标签时,系统默认识别用户为保存图片,因而产生以下菜单: 3)…
原文:JS 禁止右键,禁止复制,禁止粘贴 如何用用javascript 禁止右键,禁止复制,禁止粘贴,做站时常会用到这些代码,所以收藏了一下!1. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键特效<table border oncontextmenu=return(false)><td>no</table> 可用于Table 2. <body onselectstart=&qu…
curRadio.get(0).checked=true;//原始js调用 选中事件,curRadio是radio单个对象…
js禁止滚动条移动 var scrollFunc=function(e){ e=e||window.event; if (e&&e.preventDefault){ e.preventDefault(); e.stopPropagation(); }else{ e.returnvalue=false; //return false; } } js通过隐藏滚动条禁止其移动 document.body.parentNode.style.overflow = “hidden";//隐藏…