JS禁用右键,禁用打印,防止另存为,IE浏览器识别(转载)

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 http://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>

---------------

要真正禁止打印页面是办不到的,但是如果能设置让用户打印到的是空白,也算是实现禁止打印的目的了

<html> 
<head><title>不可打印的页面</title> 
<style> 
@media print{ 
body{display:none} 

</style> 
</head> 
<body> 
文档主要内容 
</html>

时间: 2024-08-02 02:38:14

JS禁用右键,禁用打印,防止另存为,IE浏览器识别(转载)的相关文章

JS禁用右键+禁用Ctrl+u+禁用F12

第一种方法: var arr = [123, 17, 18]; document.oncontextmenu = new Function("event.returnValue=false;"),//禁用右键 document.onselectstart = new Function("event.returnValue=false;"),//禁用选中 window.onkeydown = function (e) { var code = e.keyCode; i

JS input文本框禁用右键和复制粘贴功能的代码

代码如下: 1 function click(e) 2 { 3 if (document.all) 4 { 5 if (event.button==1||event.button==2||event.button==3) 6 { 7 oncontextmenu='return false'; 8 } 9 } 10 if (document.layers) 11 { 12 if (e.which == 3) 13 { 14 oncontextmenu='return false'; 15 } 16

教你禁用右键,也教你如何破解

很多人会遇到这种情况,在浏览页面时,发现鼠标右键不启用了.咦?刷新刷新再刷新,并无卵用,然后怒敲鼠标(没错,我就是这么暴力),更换浏览器,无用,最后弃之.其实,这是因为设计人员对页面启用了"禁用右键"功能,目的是为了防止内容被抄. 曾经也是受害者的我,如今作为一名小小的IT开发人员,就来告诉你如何"禁用右键"! 这里列举一个我在利用FineReport开发报表时遇到的案例. 启用"禁止右键" 报表大家都懂吧,启用"禁用右键"功

jquery禁用右键、文本选择功能、复制按键的实现

同时适合IE.firefox.谷歌浏览器下适用,经过筛选代码如下 //禁用右键.文本选择功能.复制按键 $(document).bind("contextmenu",function(){return false;}); $(document).bind("selectstart",function(){return false;}); $(document).keydown(function(){return key(arguments[0])}); //按键时提

jquery禁用右键、文本选择功能、复制的代码

1 //禁用右键.文本选择功能.复制按键 2 $(document).bind("contextmenu",function(){return false;}); 3 $(document).bind("selectstart",function(){return false;}); 4 $(document).keydown(function(){return key(arguments[0])}); 5 //按键时提示警告 6 function key(e){

TX Textcontrol 使用总结三——禁用右键、模版合并

一.Tx Textcontrol如何禁用右键快捷菜单? ==> 添加txContent_TextContextMenuOpening事件,实现方式如下所示: private void txContent_TextContextMenuOpening(object sender, TextContextMenuEventArgs e) { e.Cancel = true; }   二.模版合并 1.在TxControl内容结尾处进行追加模版信息 如下所示: int length = txConte

禁止选择文本和禁用右键 v1.0

var zhonghao={ //绑定事件 myAddEvent: function(obj, sEvent, fn){if(obj.attachEvent){obj.attachEvent('on'+sEvent, fn);}else{obj.addEventListener(sEvent, fn, false);}}, //禁止选择文本 disableselect:function(e){ var omitformtags=["input", "textarea"

新版【CefSharp】 禁用右键菜单 43.00+

禁用右键菜单其实是很容易的.主就要是实现一个接口 IMenuHandler ,这个接口有一个  OnBeforeContextMenu 的方法,我们在这里让返回一个false,右键菜单就消失了. internal class MenuHandler : IMenuHandler { public bool OnBeforeContextMenu(IWebBrowser browser, IContextMenuParams parameters) { return false; } } 再将这个

jquery禁用右键、文本选择功能、刷新

//禁用右键.文本选择功能.刷新 $(document).bind(“contextmenu”,function(){return false;}); $(document).bind(“selectstart”,function(){return false;}); $(document).keydown(function(){return key(arguments[0])}); //按键时提示警告 function key(e){ var keynum; if(window.event){