73 lines
1.6 KiB
HTML
73 lines
1.6 KiB
HTML
<html>
|
|
<head>
|
|
<script>
|
|
function print(message, color)
|
|
{
|
|
var paragraph = document.createElement("div");
|
|
paragraph.appendChild(document.createTextNode(message));
|
|
paragraph.style.fontFamily = "monospace";
|
|
if (color)
|
|
paragraph.style.color = color;
|
|
document.getElementById("console").appendChild(paragraph);
|
|
}
|
|
|
|
function test()
|
|
{
|
|
|
|
var selects = document.getElementsByTagName('select');
|
|
for (var i = 0; i < selects.length; i++) { // >
|
|
try {
|
|
var item = document.getElementsByTagName('select')[i].namedItem('name1');
|
|
if (item.innerHTML)
|
|
print("FOUND ITEM: " + item.innerHTML);
|
|
else
|
|
print("NO ITEM: namedItem returned" + item);
|
|
} catch (e) {
|
|
print("ERROR: " + e.message);
|
|
}
|
|
}
|
|
if (window.testRunner)
|
|
testRunner.dumpAsText();
|
|
}
|
|
</script>
|
|
<title>Test for HTMLSelectElement.namedItem()</title>
|
|
</head>
|
|
|
|
<body onload="test();">
|
|
|
|
<hr>
|
|
<div id='console'>
|
|
<H3>Test for HTMLSelectElement.namedItem()</H3>
|
|
</div>
|
|
|
|
<div style="visibility: hidden">
|
|
<select>
|
|
<option name="name1">1</option>
|
|
<option id="name1">2</option>
|
|
</select>
|
|
|
|
<select>
|
|
<option id="name1">1</option>
|
|
<option name="name1">2</option>
|
|
</select>
|
|
|
|
<select>
|
|
<option name="name1">1</option>
|
|
<option name="name1">2</option>
|
|
</select>
|
|
|
|
<select>
|
|
<option id="name1">1</option>
|
|
<option id="name1">2</option>
|
|
</select>
|
|
|
|
<select name="name1">
|
|
<option id="name2">1</option>
|
|
<option id="name3">2</option>
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|