1 <html> 2 <head> 3 <link rel="stylesheet" href="../../js/resources/js-test-style.css"> 4 <script src="../../js/resources/js-test-pre.js"></script> 5 </head> 6 <body> 7 <p id="description"></p> 8 <div id='div1'>text1</div> 9 <div id='div2'>text2</div><br> 10 11 <div id="console"></div> 12 13 <script> 14 description('This tests that items in a NodeList can be retrieved directly by name.'); 15 16 var NodeList = document.getElementsByTagName('div'); 17 var div1 = NodeList.div1; 18 var div2 = NodeList.div2; 19 20 shouldBeTrue("div1 instanceof HTMLDivElement"); 21 shouldBeTrue("div2 instanceof HTMLDivElement"); 22 // Also check that the correct divs were retrieved. 23 shouldBe("div1.innerHTML", "'text1'"); 24 shouldBe("div2.innerHTML", "'text2'"); 25 26 var successfullyParsed = true; 27 </script> 28 <script src="../../js/resources/js-test-post.js"></script> 29 </body> 30 </html> 31