WebCore/manual-tests/select-option-in-onload.html
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 04 Oct 2010 01:32:07 +0300
changeset 2 303757a437d3
parent 0 4f2f89ce4247
permissions -rw-r--r--
Revision: 201037 Kit: 201039

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" /> 
<html> 
    <head> 
    <title>Programmatically selected popup item not shown</title>
    <script type="text/javascript"> 
        function testMyPopup() {
            var myPopup = document.getElementById('testPopup');
            for (var i = 0; i < myPopup.options.length; i++) {
                if (myPopup.options[i].value == "2")
                    myPopup.options[i].selected = true;
            }
        }
    </script> 
    </head> 
    <!--body-->
    <body onload="testMyPopup();">
        <p>The popup below has the item "FAIL" selected by default in the html, but a javascript function
        triggered from the body's onload changed it to "PASS" (assuming you saw an alert telling you so).</p> 
        <p>Problem: In old versions of WebKit the change was not visible until you click on the popup.</p>
        <form action="get">
            <select id="testPopup">
                <option value="0"></option>
                <option value="1">One</option>
                <option value="2">PASS</option>
                <option value="3" selected="selected">FAIL</option>
            </select>
        </form>
    </body>
</html>