在 IE9 中出现错误 Microsoft JScript 运行时错误:'populatedropdown' is undefined on the line<input type="button"....
我假设我没有正确转义文字值。我应该如何改变?
<html>
<head>
<title>Add items to dropdown</title>
<script type="text/javascript">
function populatedropdown(var devicelist) {
var devList = document.frm.optdevices;
var arrDev = split(devicelist, ";");
devList.options.length = 0; // this removes existing options
for (var i = 0; i <= 3; i++) {
var option = new Option(arrDev[i],i);
devList.options[i] = option;
}
}
</script>
</head>
<body>
<form name="frm">
<select name="optdevices">
</select>
<input type="button" value="TestAdd" onclick="populatedropdown('201;202;203;')" />
</form>
</body>
</html>