我有以下代码:
...<some code>...
...<elements load>...
<script type="text/javascript">
var selected_city = document.getElementById('jform_city').value;
var selected_province=document.getElementById('jform_province').value;
<!-- set the onchange property for all options in provice to activate getCities() -->
document.getElementById('jform_province').onchange = function() {
getCities();
}
if(selected_province != ''){
getCities();
}
</script>
...<more elements load>....
<script type="text/javascript">
alert("TEST");
document.getElementById(selected_city).selected="1";
</script>
它从我拥有的下拉列表中选择一个选项,问题是,如果我删除警报(“”)它由于某种原因停止工作,有什么想法吗?