error.image.html (1739B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title> W3C DOM Level 3 Event: error </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 function TestCapture(evt) 17 { 18 TARGET = document.getElementById("target"); 19 20 if ((evt.type == EVENT) && (evt.currentTarget == window) && (evt.target == TARGET)) 21 { 22 TestResult = true; 23 } 24 else 25 { 26 TestResult = false; 27 } 28 } 29 30 var EVENT = "error"; 31 var TARGET; 32 var TestResult = false; 33 34 try 35 { 36 window.addEventListener(EVENT, TestCapture, true); 37 } 38 catch(ex) 39 { 40 TestResult = false; 41 } 42 43 window.onload = function() 44 { 45 if (true == TestResult) 46 { 47 PassTest(); 48 } 49 else 50 { 51 FailTest(); 52 } 53 } 54 </script> 55 </head> 56 <body> 57 <h4>Test Description: error event fires when an IMG resource failed to load.</h4> 58 59 <img id="target" src="./support/InvalidBitMap.png" alt="ERROR"> 60 61 <p>Test passes if the word "PASS" appears below.</p> 62 <div>Test result: </div> 63 <div id='testresult'>FAIL</div> 64 </body> 65 </html>