Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

31 lines (30 sloc) 1.273 kb
<!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>
Jump to Line
Something went wrong with that request. Please try again.