abort.img.html (2404B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title> W3C DOM Level 3 Event: abort </title> 5 <script type="text/javascript"> 6 var PassTest = function() 7 { 8 document.getElementById("testresult").firstChild.data = "PASS"; 9 window.localStorage.TestResult = "PASS"; 10 } 11 12 var FailTest = function() 13 { 14 document.getElementById("testresult").firstChild.data = "FAIL"; 15 window.localStorage.TestResult = "FAIL"; 16 } 17 18 function TestCapture(evt) 19 { 20 if ((evt.currentTarget == TARGET) && (evt.type == EVENT)) 21 { 22 PassTest(); 23 } 24 else 25 { 26 FailTest(); 27 } 28 } 29 30 function ReloadPage() 31 { 32 var LINK = document.getElementById("link"); 33 LINK.href = "abort.img.html"; 34 LINK.firstChild.data = "Click here to reload the page and test again."; 35 PARENT.firstChild.data = "Image loaded below. The above link should be clicked before image loads." 36 } 37 </script> 38 </head> 39 <body> 40 <h4> 41 Test Description: 42 The abort event fires when the loading of a resource has been aborted. 43 </h4> 44 45 <h3><a id="link" href="abort.testresult.html">Before image is loaded below, click here.</a></h3> 46 47 <div id="parent">Loading...<br></div> 48 49 <p>Test passes if the word "PASS" appears below.</p> 50 <div>Test result: </div> 51 <div id='testresult'>FAIL</div> 52 53 <script type="text/javascript"> 54 try 55 { 56 window.localStorage.clear(); 57 58 var EVENT = "abort"; 59 var PARENT = document.getElementById("parent"); 60 var TARGET = document.createElement("img"); 61 TARGET.width = "400"; 62 TARGET.height = "400"; 63 TARGET.src = "./support/iepreview10mb.png?" + (new Date()).valueOf(); 64 PARENT.appendChild(TARGET); 65 TARGET.onload = ReloadPage; 66 TARGET.addEventListener(EVENT, TestCapture, true); 67 } 68 catch(ex) 69 { 70 FailTest(); 71 } 72 </script> 73 </body> 74 </html>