<html> <head> <link rel="stylesheet" href="../../js/resources/js-test-style.css"> <script src="../../js/resources/js-test-pre.js"></script> </head> <body> <p id="description"></p> <div id='div1'>text1</div> <div id='div2'>text2</div><br> <div id="console"></div> <script> description('This tests that items in a NodeList can be retrieved directly by name.'); var NodeList = document.getElementsByTagName('div'); var div1 = NodeList.div1; var div2 = NodeList.div2; shouldBeTrue("div1 instanceof HTMLDivElement"); shouldBeTrue("div2 instanceof HTMLDivElement"); // Also check that the correct divs were retrieved. shouldBe("div1.innerHTML", "'text1'"); shouldBe("div2.innerHTML", "'text2'"); var successfullyParsed = true; </script> <script src="../../js/resources/js-test-post.js"></script> </body> </html>