JS 禁止IE用右键
<!--组合键: -->
IE的键盘监听最多只能作用于document上(window我试过不行)
如果内嵌了iframe并且你的焦点在iframe上,那么按键无效
这里我用CTRL+Q写的例子:
function test(){
if(event.ctrlKey&&window.event.keyCode==81){
myalert();
}
}
<!--禁止网页右键: -->
document.body.oncontextmenu=function rightClick(){ window.event.returnValue= false;}
<!--禁止网页另存为: -->
<noscript><iframe src=*.html></iframe></noscript>
<!-- 禁止选择文本: -->
<script type="text/javascript">
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
}
</script>
<!-- 禁用右键: -->
<script>
function stop(){
return false;
}
document.oncontextmenu=stop;
</script>
JS 禁止IE用右键的更多相关文章
- js禁止默认的右键菜单或出现自定义右键菜单
1.屏蔽默认的右键菜单 js: document.getElementById('myimg').oncontextmenu=function(){return false;} jquery: $(' ...
- JS 禁止刷新和右键
<!doctype html> <html> <head> <meta charset="utf-8"> <title> ...
- JS 禁止F12和右键操作控制台
1.鼠标点击事件 document.onmousedown = function mdClick(event) { var e = event || window.event || arguments ...
- js禁止网页使用右键
document.oncontextmenu=function(){ return false }
- JS 禁止右键,禁止复制,禁止粘贴
原文:JS 禁止右键,禁止复制,禁止粘贴 如何用用javascript 禁止右键,禁止复制,禁止粘贴,做站时常会用到这些代码,所以收藏了一下!1. oncontextmenu="window ...
- js禁止
很多时候需要用到js禁止相关的代码: function prohibit() { // 禁止右键 $(document).ready(function() { $(document).bind(&qu ...
- js禁止滚动条移动
js禁止滚动条移动 var scrollFunc=function(e){ e=e||window.event; if (e&&e.preventDefault){ e.prevent ...
- js禁止微信浏览器下拉显示黑底查看网址,不影响内部Scroll
开发项目跑在微信浏览器经常会遇到一个问题,微信浏览器下拉的时候会出现自带的黑色底色(显示网址)如下图: 网上好多js禁止操作的做法禁止了内部Scroll,导致页面不能滚动,上拉加载失效,例如这种做法: ...
- js禁止浏览器页面后退功能
js禁止浏览器页面后退功能: <script> $(function(){ ) { //防止页面后退 history.pushState(null, null, document.URL) ...
随机推荐
- 使用ClassyShark压缩你的项目
原文链接 : Shrinking Your Build With No Rules and do it with Class(yShark) 原文作者 : Roberto Orgiu 译文出自 : 开 ...
- [Angular] Implementing A General Communication Mechanism For Directive Interaction
We have modal implement and now we want to implement close functionality. Becuase we use a structure ...
- PostgreSQL 序列
PostgreSQL 中的序列是一个数据库对象,本质上是一个自增器.因此,序列在其他同类型数据库软件中以 autoincrment 值的形式存在.在一张表需要非随机,唯一标实符的场景下,Sequenc ...
- OpenGL_ES-纹理
OpenGL_ES2.0 -纹理 一:纹理基础: 1: 纹素的概念: 一个二维纹理在OpenGLES2.0中是非经常见的,二维纹理就是一个二维数组,每一个数据元素称为纹素,详细格式例如以下: GL_R ...
- boost::asio的http client应用笔记
1 踩过的坑 1.1 io_service boost::asio::io_service::run()会一直运行到没有任务为止,假设中途调用stop().则全部等待中的任务会立马运行.要在停止的时候 ...
- thinkphp 3.2,引入第三方类库的粗略记录
首先用第三方类库我是放到vendor里面的 根目录\ThinkPHP\Library\Vendor\Wxphp 例如创建了一个Wxphp文件夹,里面有个php文件叫做 zll.php 文 ...
- (九)RabbitMQ消息队列-通过Headers模式分发消息
原文:(九)RabbitMQ消息队列-通过Headers模式分发消息 Headers类型的exchange使用的比较少,以至于官方文档貌似都没提到,它是忽略routingKey的一种路由方式.是使用H ...
- 【Nutch2.2.1基础教程之6】Nutch2.2.1抓取流程 分类: H3_NUTCH 2014-08-15 21:39 2530人阅读 评论(1) 收藏
一.抓取流程概述 1.nutch抓取流程 当使用crawl命令进行抓取任务时,其基本流程步骤如下: (1)InjectorJob 开始第一个迭代 (2)GeneratorJob (3)FetcherJ ...
- 【Lucene4.8教程之四】分析 2014-06-22 10:51 1412人阅读 评论(0) 收藏
1.基础内容 (1)相关概念 分析(Analysis),在Lucene中指的是将域(Field)文本转换成最基本的索引表示单元--项(Term)的过程.在搜索过程中,这些项用于决定什么样的文档能够匹配 ...
- 【10.58%】【codeforces 721C】Journey
time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...