MouseEvent.button.html (1948B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title id='desc'> MouseEvent.button for mouseup Event </title> 5 <script type="text/javascript"> 6 var PassTest = function() 7 { 8 document.getElementById("testresult").firstChild.data = "PASS"; 9 } 10 11 var FailTest = function() 12 { 13 document.getElementById("testresult").firstChild.data = "FAIL"; 14 } 15 16 var EVENT = "mouseup"; 17 var TARGET; 18 var ExpectResult = [0, 1, 2]; 19 var ActualResult = []; 20 21 window.onload = function(e) 22 { 23 try 24 { 25 TARGET = document.getElementById("target"); 26 TARGET.addEventListener(EVENT, TestEvent, true); 27 } 28 catch(ex) 29 { 30 FailTest(); 31 } 32 } 33 34 function TestEvent(evt) 35 { 36 37 ActualResult.push(evt.button); 38 TARGET.value = ActualResult; 39 40 if (ExpectResult.toString() == ActualResult.toString()) 41 { 42 PassTest(); 43 } 44 } 45 </script> 46 </head> 47 <body> 48 <h4> 49 Test Description: MouseEvent.button value for mouseup event is based on current button pressed. 50 </h4> 51 52 <pre> 53 <input id="target" value=""/> 54 55 Steps: 56 1) Move the mouse pointer to the above textbox 57 2) Click the mouse button in this order: Left Button, Middle Button, Right Button 58 3) <a href="MouseEvent.button.html">Click here</a> to test again if not following the steps exactly 59 </pre> 60 61 <p>Test passes if the word "PASS" appears below after following the above steps.</p> 62 <div>Test result: </div> 63 <div id='testresult'>FAIL</div> 64 </body> 65 </html>