Posted on 2007. 9. 6. 15:15
Filed Under 카테고리 없음
<script type="text/javascript">
function changeSelect(obj1,obj2) {
obj1.onchange=function() {}
if (obj2.name=="big") {
obj2.onchange=function() { changeSelect(obj2,document.all.namedItem("medium")); }
} else if (obj2.name=="medium") {
obj2.onchange=function() { changeSelect(obj2,document.all.namedItem("third")); }
} else if (obj2.name=="third") {
obj2.onchange=function() { changeSelect(obj2,document.all.namedItem("forth")); }
} else if (obj2.name=="forth") {
obj2.onchange=function() { changeSelect(obj2,document.all.namedItem("big")); }
}
for (var i=1; i<obj1.options.length; i++) {
if (i!=obj1.selectedIndex) {
obj2.options.appendChild(obj1.options[i].cloneNode(true));
}
}
}
</script>
<SELECT name=big onChange="changeSelect(this,document.all.namedItem('medium'))">
<OPTION>첫번째
<OPTION value=cost>비용
<OPTION value=time>시간
<OPTION value=info selected>정보
<OPTION value=service>서비스</OPTION></SELECT>
<SELECT name=medium> <OPTION selected>두번째</OPTION></SELECT>
<SELECT name=third> <OPTION selected>세번째</OPTION></SELECT>
<SELECT name=forth> <OPTION selected>네번째</OPTION></SELECT>
function changeSelect(obj1,obj2) {
obj1.onchange=function() {}
if (obj2.name=="big") {
obj2.onchange=function() { changeSelect(obj2,document.all.namedItem("medium")); }
} else if (obj2.name=="medium") {
obj2.onchange=function() { changeSelect(obj2,document.all.namedItem("third")); }
} else if (obj2.name=="third") {
obj2.onchange=function() { changeSelect(obj2,document.all.namedItem("forth")); }
} else if (obj2.name=="forth") {
obj2.onchange=function() { changeSelect(obj2,document.all.namedItem("big")); }
}
for (var i=1; i<obj1.options.length; i++) {
if (i!=obj1.selectedIndex) {
obj2.options.appendChild(obj1.options[i].cloneNode(true));
}
}
}
</script>
<SELECT name=big onChange="changeSelect(this,document.all.namedItem('medium'))">
<OPTION>첫번째
<OPTION value=cost>비용
<OPTION value=time>시간
<OPTION value=info selected>정보
<OPTION value=service>서비스</OPTION></SELECT>
<SELECT name=medium> <OPTION selected>두번째</OPTION></SELECT>
<SELECT name=third> <OPTION selected>세번째</OPTION></SELECT>
<SELECT name=forth> <OPTION selected>네번째</OPTION></SELECT>