1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
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;
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>
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>