<< Index

Event Object: Mouse Button

Page | Source
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>   
    <title>XQIB: Sample page</title>
    <meta charset="UTF-8"/>
    <script type="text/javascript" src="mxqueryjs/mxqueryjs.nocache.js"></script>
    <script type="application/xquery">
      declare sequential function local:listener($loc, $evtObj) {
        if($evtObj/button = "left") then
          b:alert("Left")
        else if($evtObj/button = "right") then
          b:alert("Right")
        else if($evtObj/button = "middle") then
          b:alert("Middle")
        else
          b:alert("Unknown button")
      };

      b:addEventListener
        (b:dom()//div[@id = "clickHere"], "onmouseup", local:listener#2)
    </script>
  </head>
  <body>
    <h1>Event Object: Mouse Button</h1>
    <div id="clickHere">Click here with the left or the right button</div>
  </body>
</html>