使用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…
在做到一个页面需要禁止网页内容被选取的时候,碰到浏览器兼容的问题,解决方法如下 1.单独使用适用于IE.Chrome浏览器,主要是在head的<script>标签里面加上如下代码 document.onselectstart = function (e) { return false; } 或者 document.onselectstart = new Function('event.returnValue=false;'); 如果禁止鼠标右键,可以加上如下代码 document.oncont…
<script> //得到页面高度 var yScroll = (document.documentElement.scrollHeight >document.documentElement.clientHeight) ? document.documentElement.scrollHeight : document.documentElement.clientHeight; alert(yScroll) //得到页面宽度 var xScroll=(document.document…
<script type="text/javascript" language="javascript"> function fc(){ var browserName=navigator.appName; if (browserName=="Netscape"){ window.open('','_parent',''); window.close(); } else if(browserName=="Microsoft…
因为在获取输入框内容时,常常trim下多余的空格.而IE部分低端浏览器里的JavaScript版本不内置trim()这个清楚空格函数,而流行的浏览器里都兼容了,比如chrome,FF等.为了不让IE下报错影响使用,我们可以自己动手丰衣足食,在IE下给string原型添加一个trim自定义函数,让IE下的String类型支持trim()清楚空格. 把以下代码贴在最开始部分就好,当然清除空格的写法多种多样,以下效率没测试过,但基本够用,实在看重效率可以自己研究下正则,替换成你的写法就好! 1 2 3…
cursor:hand 与 cursor:pointer 的效果是一样,都像手形光标. 但用FireFox浏览时才注意到使用cursor:hand在FireFox.chorme里并被支持.cursor:hand :IE完全支持.但是在firefox是不支持的,没有效果.cursor:pointer :是CSS2.0的标准.所以firefox是支持的,但是IE5.0既之前版本不支持.IE6开始支持. 附:cursor属性收集 光标类型   CSS十字准心 cursor: crosshair;手 c…
jquery代码: $("body").css({ "zoom":"2", "transform":"scale(2)" }); 也可以直接在<style>里面写 <style type="text/css"> body{zoom:2;transform:scale(2)} </style>…
在页面左右一个悬浮div兼容IE6 IE7 8 9 Firefox chrome #identifier-pannel { bottom: 345px; margin-left: 512px; position: fixed; _position: absolute; left: 50%; width: 110px; _top: expression(eval(document.documentElement.scrollTop || document.body.scrollTop) +eval…
var forbidBackSpace = function (e) { // 获取event对象 var ev = e || window.event; // 获取事件源 var obj = ev.target || ev.srcElement; // 获取事件源类型 var t = obj.type || obj.getAttribute('type'); // 获取作为判断条件的事件类型 var vReadOnly = obj.readOnly; var vDisabled = obj.d…
写一个小笔记,怎么禁止HTML页面不被选中,复制. 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; } 属性有三个属性值: 1. none:用none,子元素所有的文字都不能选择,包括input输入框中的…