<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>    <script language="javascript" type="text/javascript">
        function click() {
            if (event.button == 1) { alert('你点了左键'); } if (event.button == 2) { alert('你点了右键'); }
        }
    </script></head>
<body>
    <form id="form1" runat="server">
    <div>
        <span id="sp1" onmousedown="click()">单击鼠标</span>
    </div>
    </form>
</body>
</html>

解决方案 »

  1.   


    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="frameset.aspx.vb" Inherits="JavaScript._Default" %><!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 type="text/javascript">
            function clicka() {
                if (event.button == 1)
                { alert('你点了左键'); }
                if (event.button == 2)
                { alert('你点了右键'); }
            } 
        </script>别用click,随便改个名字.</head>
    <body>
        <form id="form1" runat="server">
        <div>
            <div style="height: 200px; width: 300px" onmousedown="javascript:clicka();">
            </div>
        </div>
        </form>
    </body>
    </html>