mouseenter.ctrlKey.html (1872B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title id='desc'> MouseEvent.ctrlKey for mouseenter 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 = "mouseenter"; 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.ctrlKey == true)) 35 { 36 TARGET.style.border = "solid 1px green"; 37 PassTest(); 38 } 39 else 40 { 41 FailTest(); 42 } 43 } 44 </script> 45 </head> 46 <body> 47 <h3>DOM Events</h3> 48 <h4> 49 Test Description: MouseEvent.ctrlKey returns true if 'Control' key is depressed, otherwise false. 50 </h4> 51 52 <pre> 53 <img id="target" src="./support/iepreview.png" width="256" height="256" style="border:solid 1px red" /> 54 55 Steps: 56 1) Press and hold down the '{CTRL}' key 57 2) Move the mouse pointer into the image 58 </pre> 59 60 <p>Test passes if the word "PASS" appears below after following the above steps.</p> 61 <div>Test result: </div> 62 <div id='testresult'>FAIL</div> 63 </body> 64 </html>