select下拉框之去掉重複
阿新 • • 發佈:2019-02-06
window.onload =function(){
select1();
select2();
}
function select1() {
var opts = document.getElementById('add_stdevice_code').options;
var obj = new Object(), index = 0;
while (index < opts.length) {
if (opts[index].text in obj) opts[index] = null;
else {
obj[opts[index].text] = opts[index].text;
index++;
}
}
obj = null;
}
function select2() {
var opts = document.getElementById('add_stdevice_stcd').options;
var obj = new Object(), index = 0;
while (index < opts.length) {
if (opts[index].text in obj) opts[index] = null;
else {
obj[opts[index].text] = opts[index].text;
index++;
}
}
obj = null;
}
select1();
select2();
}
function select1() {
var opts = document.getElementById('add_stdevice_code').options;
var obj = new Object(), index = 0;
while (index < opts.length) {
if (opts[index].text in obj) opts[index] = null;
else {
obj[opts[index].text] = opts[index].text;
index++;
}
}
obj = null;
}
function select2() {
var opts = document.getElementById('add_stdevice_stcd').options;
var obj = new Object(), index = 0;
while (index < opts.length) {
if (opts[index].text in obj) opts[index] = null;
else {
obj[opts[index].text] = opts[index].text;
index++;
}
}
obj = null;
}