任何人都可以请告诉我如何让这个脚本在IE 7中运行?当我运行这个时,没有任何反应。JavaScript函数不能在IE 7中工作
<html>
<head>
<script language="JavaScript">
function moveSelectedOption() {
// Fetch references to the <select> elements.
var origin = document.getElementById('origin_select');
var target = document.getElementById('target_select');
// Fetch the selected option and clone it.
var option = origin.options[origin.selectedIndex];
var copy = option.cloneNode(true);
// Add the clone to the target element.
target.add(copy, null);
}
</script>
</head>
<body>
<select id="origin_select" multiple>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
</select>
<select id="target_select" multiple>
<option value="C1">C1</option>
</select>
<button onclick="moveSelectedOption()">Add</button>
<!-- <input type="button" onClick="moveSelectedOption()" value="AddMeToo" /> this does not work either-->
</body>
</html>
and ie8 too ..... – Shoban 2010-04-09 11:10:43
“Nothing”很少发生。你有任何错误信息? – Guffa 2010-04-09 11:25:31