我看了 很多 网上火狐一般都不支持右击事件 不得以 只能来这请各位大虾帮忙。。我只要获得兼容于火狐的右击事件 就行

解决方案 »

  1.   

    是这个样子吗?<!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>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>无标题文档</title>    <script type="text/javascript">
            window.onload = function() {
                document.getElementById("div").onmousedown = function(event) {
                    var e = window.event || event;
                    if (e.button == 2) {
                        alert("点击了右键。");
                    }
                }
                document.getElementById("div").oncontextmenu = function() {
                    return false;
                }
            }
            
            
        </script></head>
    <body>
        <div id="div" style="width: 100px; height: 100px; border: 2px solid #ccc">
        </div>
    </body>
    </html>
      

  2.   

    obj.oncontextmenu = function(){
       alert(111);
       return false;
    };