summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/manual-tests/select-option-in-onload.html
blob: 3a4d8a68e0d6a04e5a575aaccf4de7a520b1e395 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!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>