28 lines
839 B
HTML
28 lines
839 B
HTML
<head>
|
|
<script>
|
|
function test()
|
|
{
|
|
if (window.testRunner)
|
|
testRunner.dumpAsText();
|
|
var select = document.getElementById('select');
|
|
var index = select.selectedIndex;
|
|
document.forms[0].reset();
|
|
var message = "selected index is " + index + " before and " + select.selectedIndex + " after reset().";
|
|
var paragraph = document.createElement('p');
|
|
paragraph.appendChild(document.createTextNode(message));
|
|
document.getElementById('console').appendChild(paragraph);
|
|
}
|
|
</script>
|
|
</head>
|
|
<body onload="test();">
|
|
<p>This tests reseting of a select box with no selected options using JavaScript. If successful, both times the selected index should be 0.<form>
|
|
<form>
|
|
<select id="select">
|
|
<option>Option 0</option>
|
|
<option>Option 1</option>
|
|
<option>Option 2</option>
|
|
</select>
|
|
</form>
|
|
<p id="console"></p>
|
|
</body>
|