JavaScript 中禁止用户右键菜单,复制,选取,Ctrl,Alt,Shift. 获取宽高,清除浮动
//禁用右键菜单
document.oncontextmenu = function(){
event.returnValue = false;
}
//禁用选取内容
document.onselectstart = function() {
event.returnValue = false;
}
//禁用复制
document.oncopy = function() {
event.returnValue = false;
}
//禁用键盘中的ctrl、alt、shift
document.onkeydown = function(){
if( event.ctrlKey ){
return false;
}
if ( event.altKey ){
return false;
}
if ( event.shiftKey ){
return false;
}
}
浏览器宽高
var w = document.documentElement.clientWidth || document.body.clientWidth;
var h = document.documentElement.clientHeight || document.body.clientHeight;
网页正文宽高
var w = document.documentElement.scrollWidth || document.body.scrollWidth;
var h = document.documentElement.scrollHeight || document.body.scrollHeight;
网页可见区域宽高,包括滚动条等边线(会随窗口的显示大小改变)
var w = document.documentElement.offsetWidth || document.body.offsetWidth ;
var h = document.documentElement.offsetHeight || document.body.offsetHeight ;
网页卷去的距离与偏移量
1.scrollLeft:设置或获取位于给定对象左边界与窗口中目前可见内容的最左端之间的距离;
2.scrollTop:设置或获取位于给定对象最顶端与窗口中目前可见内容的最左端之间的距离;
3.offsetLeft:设置或获取位于给定对象相对于版面或由offsetParent属性指定的父坐标的计算左侧位置;
4.offsetTop:设置或获取位于给定对象相对于版面或由offsetParent属性指定的父坐标的计算顶端位置;
清除浮动 在浮动元素的父元素上加上此内容
.clearfix:after {
content: "";
/*//设置内容为空*/
height:;
/*//高度为0*/
line-height:;
/*//行高为0*/
display: block;
/*//将文本转为块级元素*/
visibility: hidden;
/*//将元素隐藏*/
clear: both;
/*//清除浮动*/
width:0
}
.clearfix {
zoom:;
/*为了兼容IE*/
}
JavaScript 中禁止用户右键菜单,复制,选取,Ctrl,Alt,Shift. 获取宽高,清除浮动的更多相关文章
- html页面禁止用户右键粘贴复制保存的代码
HTML页面禁止选择.页面禁止复制.页面禁止右键 原创古城寨主2018-03-01 17:50:59评论(1)228人阅读 HTML页面内容禁止选择.复制.右键 刚在一个看一个站点的源代码的的时候 ...
- 禁止网页右键和复制,ctrl+a都不行。取消页面默认事件【全】。
document.oncontextmenu=new Function("event.returnValue=false");document.onselectstart=new ...
- (转载)delphi实例TDBGrid用右键菜单复制行粘贴行
delphi实例TDBGrid用右键菜单复制行粘贴行 这个从本质上来说就是DBGrid后台数据库的插入 右键复制当前行的相关数据到临时变量点粘贴时,覆盖数据或插入数据! db为数据库: 字段名id,n ...
- JS 禁止浏览器右键菜单和刷新
<script language="javascript"> //禁止按键F5 document.onkeydown = function(e){ e = window ...
- 禁止按键F5和禁止鼠标右键菜单 js代码
<script language="javascript"> //禁止按键F5 document.onkeydown = function(e){ e = window ...
- zendstudio快捷键复制行Ctrl+Alt+向下无效的解决方法
今天不断地在百度输入类似"zendstudio快捷键复制行Ctrl+Alt+向下无效"这样的关键字,里面搜索到的内容都是在说系统的显卡驱动Ctrl+Alt+方向键和ZendStud ...
- Jquery如何禁止鼠标右键菜单
jquery中使用contextmenu事件,如果返回true,则允许右键菜单:如果返回false,则禁止右键菜单 导入文件 <script type="text/javascript ...
- Asp.net网页中禁止使用剪切、复制、粘贴的方法
工欲善其事,必先利其器 在asp.net开发的网页中,有时候需要禁止用户粘贴复制密码,禁止用户copy文章直接粘贴到文本框中.采取的方法是直接在限制控件的地方写上禁止粘贴文本的代码.但是这样不是很方便 ...
- 屏蔽F12审查元素,禁止使用右键菜单
一.屏蔽F12审查元素 <script type="text/javascript"> document.onkeydown = function() { ) { al ...
随机推荐
- Spring boot 整合hive-jdbc导致无法启动的问题
使用Spring boot整合Hive,在启动Spring boot项目时,报出异常: 经过排查,是maven的包冲突引起的,具体做法,排除:jetty-all.hive-shims依赖包.对应的po ...
- [sh]md5sum接变量,find排除,sh判断文件存在
1.md5sum md5sum `cat path_to_file|dos2unix` 注: 发现有些linux是gbk编码, 导致md5或ls 接变量后报错.需要dos2unix处理 2.find排 ...
- 546A
#include <stdio.h> int main() { int n1,n2,n3; int ans; scanf("%d %d %d", &n1, &a ...
- [LeetCode] 492. Construct the Rectangle_Easy tag: Math
For a web developer, it is very important to know how to design a web page's size. So, given a speci ...
- [LeetCode] 619. Biggest Single Number_Easy tag: SQL
Table number contains many numbers in column num including duplicated ones.Can you write a SQL query ...
- maven 详解二
转自 http://www.cnblogs.com/whgk/p/7121336.html 前一节我们明白了maven是个什么玩意,这一节就来讲讲他的一个重要的应用场景,也就是通过maven将一个ss ...
- ionic环境配置
1.现在 npm install -g ionic 直接安装ionic2版本.用ionic1版本开发,用 npm install -g ionic@1.6. 2.第一次输入: ionic serve ...
- C# 指定http请求使用Tls1.2
转载于 https://blog.csdn.net/yanghaitian/article/details/77498872 客户端语言 版本 类库 是否支持 兼容方案 Java 1.6.115之 ...
- 判断数组对象里面的某个属性全部为true才执行下一步操作
比如数据[ {name:'张三',isshow:'false'},name:'李四',isshow:'false'}, ] 这里是自己写的验证,没用elemten的 如果有2张票,需要刷2张身份证,则 ...
- Cocos Creator 音频API控制调频
*****音频的一些控制***** cc.audioEngine.playMusic(this.BGAudio,true);//播放音乐(true代表循环) cc.audioEngine.stopMu ...