問題很大
<body>
<select id="slt1" size="7" style="width: 100px;"><br /><br /><br /><br /><br />
<option>1</option>
<option>2</option>
</select>
<select id="slt2" size="9" style="width: 200px;height: 400px;">
<option>2</option>
<option>2</option>
<option>2</option>
<option>2</option>
</select>
<input type="button" value="huan" id="btn1" />
<input type="button" value="huan2" id="btn2" />
<script>
document.getElementById(‘btn1‘).onclick = function() {
var slt1 = document.getElementById(‘slt1‘);
var slt2 = document.getElementById(‘slt2‘);
if(btn1.onclick) {
slt1.outerHTML+="<option>" + slt1.value + "</option>";
slt1.value=""
slt2.innerHTML+="<option>" +slt1.value+ "</option>";
}
}
document.getElementById(‘btn2‘).onclick = function() {
var slt1 = document.getElementById(‘slt1‘);
var slt2 = document.getElementById(‘slt2‘);
if(btn2.onclick){
slt2.outerHTML+="<option>" + slt2.value + "</option>";
slt1.innerHTML+="<option>" + slt2.value + "</option>";
}
}
</script>
</body>
當點擊按鈕的時候是.onclick麽,修改的內容是用st.value表示麽
問題很大