test_bug641198.html (1240B)
1 <!DOCTYPE HTML> 2 <html class="reftest-wait"> 3 <head> 4 <title>Test for bug 641198</title> 5 <link rel="stylesheet" href="ImageDocument.css"> 6 <style type="text/css" media=screen> 7 a.animated1 { 8 display: block; 9 width: 40px; 10 height: 40px; 11 background: url("animation1a.gif") no-repeat 0 0; 12 } 13 14 a.animated1 span { 15 position: absolute; 16 top: -999em; 17 } 18 19 a.animated2 { 20 display: block; 21 width: 40px; 22 height: 40px; 23 background: url("animation2a.gif") no-repeat 0 0; 24 } 25 26 a.animated2 span { 27 position: absolute; 28 top: -999em; 29 } 30 </style> 31 </head> 32 <body onload="doTimeout()"> 33 34 <a id="animated" href="#" title="Animated"><span>Animated</span></a> 35 36 <script> 37 // We check whether changing the class will lead to the animation being 38 // run from the beginning, even if the animation was already shown 39 // before. 40 var counter = 0; 41 function doTimeout() { 42 if (counter == 4) { 43 document.documentElement.className = ''; 44 } else { 45 document.getElementById("animated").setAttribute("class", "animated" + ((counter % 2)+1)); 46 setTimeout(doTimeout, counter == 3 ? 500 : 250); // Wait a bit more for the last one, to prevent oranges 47 } 48 counter++; 49 } 50 </script> 51 </body> 52 </html>