javascript簡單練習案例
阿新 • • 發佈:2018-12-25
function quanaddright() {
var s1 = document.getElementById("s1");
var s2 = document.getElementById("s2");
var op = s1.getElementsByTagName("option");
for(var i = 0; i < op.length;) {
var o = op[0]
//document.writeln(o.innerHTML);
//alert(op.length+"i="+i);
s2.appendChild(o);
}
}
function quanaddleft() {
var s1 = document.getElementById("s1");
var s2 = document.getElementById("s2");
var op = s2.getElementsByTagName("option" );
for(var i = 0; i < op.length;) {
var o = op[0]
//document.writeln(o.innerHTML);
//alert(op.length+"i="+i);
s1.appendChild(o);
}
}
function xuanaddright() {
var s1 = document.getElementById("s1");
var s2 = document.getElementById("s2");
var op = s1.getElementsByTagName("option");
for(var i = 0; i < op.length;) {
var o = op[i]
if(o.selected) {
s2.appendChild(o);
} else {
i++;
}
}
}
function xuanaddleft() {
var s1 = document.getElementById("s1");
var s2 = document.getElementById("s2");
var op = s2.getElementsByTagName("option");
for(var i = 0; i < op.length;) {
var o = op[i]
if(o.selected) {
s1.appendChild(o);
} else {
i++;
}
}
}