<html>
<body>
<p>This tests that a locally scoped variable in an event handler of a form
takes precedence over items of form.

<form>
<select onChange="var value = this.value;this.options[0].selected=true; if(value=='C') document.getElementById('sourceViewDiv').innerHTML='This test: PASSED!'">
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
</select>

<div id='sourceViewDiv'>This test: FAILED</div>

<script>
if (window.testRunner)
  testRunner.dumpAsText();

var x=document.getElementsByTagName('select')[0];
x.options[2].selected=true;
var evt = document.createEvent("HTMLEvents");
evt.initEvent("change", true, true);
x.dispatchEvent(evt);
</script>
</form>

</body>
</html>
