oncontextmenu="window.event.returnValue=false" style="overflow-y: hidden; overflow-x: hidden"ajs9 leftmargin="0" topmargin="0"

<body oncontextmenu="return false"></body>

<!--禁止网页另存为: -->

<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>

1. oncontextmenu="window.event.returnvalue=false" 将彻底屏蔽鼠标右键

<table border oncontextmenu=return(false)><td>no</table> 可用于Table

2. <body onselectstart="return false"> 取消选取、防止复制

3. onpaste="return false" 不准粘贴

4. oncopy="return false;" oncut="return false;" 防止复制

5. <link rel="Shortcut Icon" href="favicon.ico"> IE地址栏前换成自己的图标

6. <link rel="Bookmark" href="favicon.ico"> 可以在收藏夹中显示出你的图标

7. <input style="ime-mode:-Disabled"> 关闭输入法

8. 永远都会带着框架

<script language="javascript"><!--

if (window == top)top.location.href = "frames.htm"; //frames.htm为框架网页

// --></script>

9. 防止被人frame

<SCRIPT LANGUAGE=javascript><!--

if (top.location != self.location)top.location=self.location;

// --></SCRIPT>

11. <input type=button value=查看网页源代码

onclick="window.location = `view-source:`+ http://www.tonightdream.com/`";>

12.删除时确认

<a href=`javascript:if(confirm("确实要删除吗?"location="boos.asp?&areyou=删除&page=1"`>删除</a>

13. 取得控件的绝对位置

//javascript

<script language="javascript">

function getIE(E){

var t=e.offsetTop;

var l=e.offsetLeft;

while(e=e.offsetParent){

t+=e.offsetTop;

l+=e.offsetLeft;

<!--右键开始-->

<script language="JavaScript">

<!--

if (window.Event)

document.captureEvents(Event.MOUSEUP);

function nocontextmenu()

{

event.cancelBubble = true

event.returnValue = false;

return false;

}

function norightclick(e)

{

if (window.Event)

{

if (e.which == 2 || e.which == 3)

return false;

}

else

if (event.button == 2 || event.button == 3)

{

event.cancelBubble = true

event.returnValue = false;

return false;

}

}

document.oncontextmenu = nocontextmenu; // for IE5+

document.onmousedown = norightclick; // for all others

//-->

</script>

<!-- 禁止选择文本: -->

<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 language="javascript" type="text/javascript">

<!--

function key(){

if(event.shiftKey){

window.close();}

//禁止shift

if(event.altKey){

window.close();}

//禁止alt

if(event.ctrlKey){

window.close();}

//禁止ctrl

return false;}

//document.onkeydown=key;

if (window.Event)

document.captureEvents(Event.MOUSEUP);

//swordmaple javascript article.

//from www.jx165.com

function nocontextmenu(){

event.cancelBubble = true

event.returnValue = false;

return false;}

function norightclick(e){

if (window.Event){

if (e.which == 2 || e.which == 3)

return false;}

else

if (event.button == 2 || event.button == 3){

event.cancelBubble = true

event.returnValue = false;

return false;}

}

//禁止右键

document.oncontextmenu = nocontextmenu; // for IE5+

document.onmousedown = norightclick; // for all others

//-->

</script>

JS 禁用鼠标右键的更多相关文章

  1. HTML,JS禁止鼠标右键、禁止全选、复制、粘贴的方法

    禁止鼠标右键.禁止全选.复制.粘贴: oncontextmenu事件禁用右键菜单: js代码: document.oncontextmenu = function(){ event.returnVal ...

  2. 遇到Web页面禁用鼠标右键操作时,该如何解禁?

    在使用Selenium做Web UI自动化测试过程中,经常需要鼠标右击Web页面检查DOM节点,用于获取Web元素的定位信息.一般情况下,绝大多数页面都是能够响应鼠标右击操作的.但出于某些目的,有些W ...

  3. JQuery中判断checkbox是否选中与禁用鼠标右键

    if ($("#wds_checkbox").attr("checked")) { flag = ; } else { flag = ; } 禁用鼠标右键 // ...

  4. js的鼠标右键简单菜单

    实现点击鼠标右键时出来菜单代码如下: 主要运用oncontextmenu事件,oncontextmenu 事件在元素中用户右击鼠标时触发并打开上下文菜单. <!DOCTYPE html> ...

  5. js自定义鼠标右键菜单

    document.oncontextmenu = function(e) { return false; } document.onmousedown = function(e) { switch(e ...

  6. JS屏蔽鼠标右键

    //方法1: function stop() {    return false;}document.oncontextmenu = stop;//方法2: window.document.oncon ...

  7. js实现鼠标右键自定义菜单(弹出层),并与树形菜单(TreeView)、iframe合用(兼容IE、Firefox、Chrome)

    <table class="oa-el-panel-tree"> <tr> <td style="vertical-align: top; ...

  8. html body标签的几个属性 禁用鼠标右键,禁用鼠标选中文字等

    <body oncontextmenu='return false' ondragstart='return false' onselectstart ='return false' onsel ...

  9. JS禁止鼠标右键、禁止全选、复制、粘贴的方法(所谓的防盗功能)

    简述:一个防君子不防小人的鸡肋的功能,针对小白还行. 代码如下: <script> //都能支持 document.oncontextmenu = function (e) { retur ...

随机推荐

  1. 导出pdf功能

    本程序下载地址: PDF是我们极其常用的文件格式,但对如何生成PDF,个人一直觉得很神秘,其实利用一些公开的PDF库,我们就可以直接生成PDF文件,而不用关注PDF文件的内部细节.我知道的PDF库有如 ...

  2. Golang 入门 : 数组

    数组是指一系列同一类型数据的集合.数组中包含的每个数据被称为数组元素(element),这种类型可以是任意的原始类型,比如 int.string 等,也可以是用户自定义的类型.一个数组包含的元素个数被 ...

  3. C#自定义应用程序上下文对象+IOC自己实现依赖注入

    以前的好多代码都丢失了,加上最近时间空一些,于是想起整理一下以前的个人半拉子项目,试试让它们重生.自从养成了架构师视觉 搭建框架之后,越来 越看不上以前搭的框架了.先撸个上下文对象加上实现依赖注入.由 ...

  4. Python中的垃圾回收与del语句

    python中的垃圾回收采用计数算法 一个对象如果被引用N次,则需要N次(即计算引用次数为零时)执行del 才能回收此对象. a = 100 b = a del a print(b) print(a) ...

  5. [Alpha阶段]第六次Scrum Meeting

    Scrum Meeting博客目录 [Alpha阶段]第六次Scrum Meeting 基本信息 名称 时间 地点 时长 第六次Scrum Meeting 19/04/10 教2 1层 50min 相 ...

  6. Laravel 入口文件解读及生命周期

    这里只贴index.php的代码, 深入了解的请访问    https://laravel-china.org/articles/10421/depth-mining-of-laravel-life- ...

  7. Java 显示读取properties 乱码解决方案

    项目开发时,在配置springmvc 校验错误提示信息时,配置到properties的中文,在前端取出时,显示为乱码,可以确定properties 配置文件已经被设为UTF-8编码,在springmv ...

  8. centos django Failed to load resource: net::ERR_INCOMPLETE_CHUNKED_ENCODING

    os环境 centos python2.7.5 django1.10.8 class AdminAutoRunTask(View): """ 自动跑外放任务 " ...

  9. UVA 1627 Team them up!

    https://cn.vjudge.net/problem/UVA-1627 题目 有n(n≤100)个人,把他们分成非空的两组,使得每个人都被分到一组,且同组中的人相互认识.要求两组的成员人数尽量接 ...

  10. BZOJ4762 最小集合(动态规划+容斥原理)

    https://www.cnblogs.com/AwD-/p/6600650.html #include<iostream> #include<cstdio> #include ...