| <html> |
| <body > |
| Purpose: To test if the both DOM1 and DOM2 versions of the add() method add an option to a dropdown list. You should see three "TEST PASSED" lines below. |
| <br> |
| <form name="my_form"> |
| <select name="my_select"> |
| <option value="a">a</option> |
| </select> |
| </form> |
| |
| <script> |
| if (window.layoutTestController) |
| layoutTestController.dumpAsText(); |
| |
| // DOM1 |
| document.my_form.my_select.add(new Option("c", "c")); |
| if (document.my_form.my_select.options[1].value == 'c') |
| { |
| document.write("DOM1 TEST PASSED"); |
| } |
| else{ |
| document.write("DOM1 TEST FAILED"); |
| } |
| document.write('<br>'); |
| |
| // DOM2 |
| document.my_form.my_select.add(new Option("b", "b"), document.my_form.my_select.options[1]); |
| if (document.my_form.my_select.options[1].value == 'b') |
| { |
| document.write("DOM2 full TEST PASSED"); |
| } |
| else{ |
| document.write("DOM2 full TEST FAILED"); |
| } |
| document.write('<br>'); |
| |
| document.my_form.my_select.add(new Option("d", "d"), null); |
| if (document.my_form.my_select.options[3].value == 'd') |
| { |
| document.write("DOM2 null TEST PASSED"); |
| } |
| else{ |
| document.write("DOM2 null TEST FAILED"); |
| } |
| </script> |
| </body> |
| </html> |