Prototype - Event isLeftClick() 方法
此方法确定与按钮相关的鼠标事件是否与"左"(实际上是主)按钮有关。
语法
Event.isLeftClick(event);
返回值
如果按下左键,则返回 true。
示例
注意 − 似乎在 MSIE 中不起作用。
<html> <head> <title>Prototype examples</title> <script type = "text/javascript" src = "/javascript/prototype.js"></script> <script> // 注册事件"click"及相关回调。 Event.observe(document, 'click', respondToClick); // 回调函数来处理事件。 function respondToClick(event) { var bool = Event.isLeftClick(event); if ( bool ) { alert("Left button is pressed...." ); } } </script> </head> <body> <p id = "note"> Click anywhere to see the result.</p> <p>This example may not work in IE.</p> <p id = "para1">This is paragraph 1</p> <p id = "para2">This is paragraph 2</p> <div id = "division">This is divsion.</div> </body> </html>