由程序驱动运行的事件,当然 event.button 为 0

解决方案 »

  1.   

    你看个例子吧:
    <HTML>
    <HEAD>
    <SCRIPT>
    function fnFireEvents()
    {
    document.getElementById("oDiv").innerHTML = "The cursor has moved over me!";
    document.getElementById("oButton").fireEvent("onclick");
    }
    </SCRIPT>
    </HEAD>
    <BODY>
    <h1>Using the fireEvent method</h1>
    By moving the cursor over the DIV below, the button is clicked.
    <P>
    <DIV ID="oDiv" onmouseover="fnFireEvents();">
    Mouse over this!
    </DIV>
    <p>
    <BUTTON ID="oButton" ONCLICK="this.innerHTML='I have been clicked!'" >
    Button</BUTTON>
    </BODY>
    </HTML>