KeyboardEvent.modifiers.html (2009B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title id='desc'> KeyboardEvent.getModifierState() and 'AltGraph' modifier key </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 = "keydown"; 17 var TARGET; 18 19 window.onload = function(e) 20 { 21 try 22 { 23 TARGET = document.getElementById("target"); 24 TARGET.addEventListener(EVENT, TestEvent, true); 25 } 26 catch(ex) 27 { 28 FailTest(); 29 } 30 } 31 32 function TestEvent(evt) 33 { 34 if ((evt.type == EVENT) && evt.getModifierState("AltGraph")) 35 { 36 PassTest(); 37 TARGET.removeEventListener(EVENT, TestEvent, true); 38 } 39 else 40 { 41 FailTest(); 42 } 43 } 44 </script> 45 </head> 46 <body> 47 <h3>DOM Events</h3> 48 <h4> 49 Test Description: Some operating systems simulate the 'AltGraph' modifier key 50 with the combination of the 'Alt' and 'Control' modifier keys. Implementations 51 are encouraged to use the 'AltGraph' modifier key. 52 </h4> 53 54 <pre> 55 <input id="target" value=""/> 56 57 Steps: 58 1) Click in the above textbox using mouse 59 2) Press and hold down '{CTRL}' key and then press '{ALT}' key on the keyboard 60 </pre> 61 62 <p>Test passes if the word "PASS" appears below after following the above steps.</p> 63 <div>Test result: </div> 64 <div id='testresult'>FAIL</div> 65 </body> 66 </html>