OLD | NEW |
1 <head> | 1 <head> |
2 <script> | 2 <script> |
3 function test() | 3 function test() |
4 { | 4 { |
5 if (window.testRunner) | 5 if (window.testRunner) |
6 testRunner.dumpAsText(); | 6 testRunner.dumpAsText(); |
7 var select = document.getElementById('select'); | 7 var select = document.getElementById('select'); |
8 var index = select.selectedIndex; | 8 var index = select.selectedIndex; |
9 document.forms[0].reset(); | 9 document.forms[0].reset(); |
10 var message = "selected index is " + index + " before and " + select.selecte
dIndex + " after reset()."; | 10 var message = "selected index is " + index + " before and " + select.selecte
dIndex + " after reset()."; |
11 var paragraph = document.createElement('p'); | 11 var paragraph = document.createElement('p'); |
12 paragraph.appendChild(document.createTextNode(message)); | 12 paragraph.appendChild(document.createTextNode(message)); |
13 document.getElementById('console').appendChild(paragraph); | 13 document.getElementById('console').appendChild(paragraph); |
14 } | 14 } |
15 </script> | 15 </script> |
16 </head> | 16 </head> |
17 <body onload="test();"> | 17 <body onload="test();"> |
18 <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> | 18 <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> |
19 <form> | 19 <form> |
20 <select id="select"> | 20 <select id="select"> |
21 <option>Option 0</option> | 21 <option>Option 0</option> |
22 <option>Option 1</option> | 22 <option>Option 1</option> |
23 <option>Option 2</option> | 23 <option>Option 2</option> |
24 </select> | 24 </select> |
25 </form> | 25 </form> |
26 <p id="console"></p> | 26 <p id="console"></p> |
27 </body> | 27 </body> |
OLD | NEW |