zoukankan      html  css  js  c++  java
  • js 右键菜单

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
    <title></title>
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <script type="text/javascript">
    $(document).ready(function () {
    var mouseX;
    var mouseY;
    $(document).bind("contextmenu", function (e) { //去掉默认右键功能
    return false;
    });
    $(document).mousedown(function (e) {
    mouseX = e.clientX;
    mouseY = e.clientY;
    if (3 == e.which) { //右键单击
    $("#area").css('margin-left', mouseX);
    $("#area").css('margin-top', mouseY);
    $("#area").show();
    } else if (1 == e.which && !($('#area').find(e.target).length != 0 || $('#area')[0] == $(e.target)[0])) { //左键单击
    $("#area").hide();
    }
    return
    })
    
    }) 
    </script>
    </head>
    <body>
    <form id="form1" runat="server">
    <div> 
    <div id="area" style="150px; height:200px; background-color:red; display:none;" >
    <input type="button" value="我是按钮" onmousedown="alert('11');" />
    </div>
    </div>
    </form>
    </body>
    </html>
    

      

  • 相关阅读:
    指针和数组的关系
    深入学习数组
    const关键字与指针
    野指针是什么
    指针带来的一些符号的理解
    指针的本质
    内存管理之堆
    内存管理之栈
    元类
    断点调式和面向对象进阶
  • 原文地址:https://www.cnblogs.com/wdw31210/p/2540262.html
Copyright © 2011-2022 走看看