| <!DOCTYPE HTML> |
| <html> |
| <head> |
| <title>Forms</title> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| </head> |
| <body> |
| <p> |
| <h3>select_selectedIndex</h3> |
| </p> |
| |
| <li>In select control second item is selected.</li> |
| |
| <hr> |
| |
| <div id="log"></div> |
| |
| <form method="post" |
| enctype="application/x-www-form-urlencoded" |
| action="" |
| id="input_form"> |
| <p> |
| <label for="unittype">Select unit type:</label> |
| <select id="unittype" name="unittype"> |
| <option value="1"> Miner </option> |
| <option value="2"> Puffer </option> |
| <option value="3" selected> Snipey </option> |
| <option value="4"> Max </option> |
| <option value="5"> Firebot </option> |
| </select> |
| </p> |
| </form> |
| |
| <script> |
| |
| var select = document.getElementById("unittype"); |
| var selectedindex = select.selectedIndex; |
| |
| if (selectedindex != 2) { |
| test(function() { |
| assert_true(false, "selectedindex attribute is not correct."); |
| }); |
| } |
| |
| select.selectedIndex = 1; |
| </script> |
| |
| </body> |
| </html> |