zoukankan      html  css  js  c++  java
  • 禁止右键,禁止拖曳,禁止选择,禁止网页另存为

    View Code
    <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;
    }
    }

    //************************禁止选择***************************
    function noSelect()
    {
    return false;
    }

    //************************禁止拖曳***************************
    function noDragstart()
    {
    return false;
    }

    //************************清空剪切板*************************
    function keyDown()
    {
    var iekey = event.keyCode;
    //alert(iekey);
    if(iekey == 42)
    {
    //window.clipboardData.setData('img','')

    window.clipboardData.clearData();
    }
    }

    //-->
    </script>

    <!--禁止网页另存为-->
    <noscript> <iframe src="*.htm"></iframe> </noscript>


    <noscript> <iframe src="*.htm"></iframe> </noscript><SCRIPT language=JavaScript>
    document.oncontextmenu = nocontextmenu;
    document.onmousedown = norightclick;
    document.ondragstart = noDragstart;
    document.onselectstart = noSelect;
    document.onselect = document.selection.empty();
    document.onkeydown = keyDown;
    </SCRIPT>
  • 相关阅读:
    C++多态的实现原理
    C++编程之面向对象的三个基本特征
    C/C++中static关键字详解
    C/C++中static关键字作用总结
    Linux防CC攻击脚本
    linux下防火墙iptables原理及使用
    linux下使用 TC 对服务器进行流量控制
    awr报告与statspack报告
    awr报告
    statspack报告
  • 原文地址:https://www.cnblogs.com/xxdotnet/p/2425364.html
Copyright © 2011-2022 走看看