WebCore/manual-tests/select-option-in-onload.html
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       
     2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" /> 
       
     3 <html> 
       
     4     <head> 
       
     5     <title>Programmatically selected popup item not shown</title>
       
     6     <script type="text/javascript"> 
       
     7         function testMyPopup() {
       
     8             var myPopup = document.getElementById('testPopup');
       
     9             for (var i = 0; i < myPopup.options.length; i++) {
       
    10                 if (myPopup.options[i].value == "2")
       
    11                     myPopup.options[i].selected = true;
       
    12             }
       
    13         }
       
    14     </script> 
       
    15     </head> 
       
    16     <!--body-->
       
    17     <body onload="testMyPopup();">
       
    18         <p>The popup below has the item "FAIL" selected by default in the html, but a javascript function
       
    19         triggered from the body's onload changed it to "PASS" (assuming you saw an alert telling you so).</p> 
       
    20         <p>Problem: In old versions of WebKit the change was not visible until you click on the popup.</p>
       
    21         <form action="get">
       
    22             <select id="testPopup">
       
    23                 <option value="0"></option>
       
    24                 <option value="1">One</option>
       
    25                 <option value="2">PASS</option>
       
    26                 <option value="3" selected="selected">FAIL</option>
       
    27             </select>
       
    28         </form>
       
    29     </body>
       
    30 </html>