日期:2014-05-17 浏览次数:20667 次
<SCRIPT LANGUAGE="JavaScript"> function a(t1) { var t2 = document.getElementsByName("t")[1]; t2.options.length=0; var j=0; for(var i=0;i<t1.options.length ;i++ ) { if(i!=t1.selectedIndex) { t2.options[j] = new Option(t1.options[i].text,t1.options[i].value); j++; } } } </SCRIPT> <select name="t" onchange="a(this)"> <option value=a>a </option> <option value=b>b </option> <option value=c>c </option> <option value=d>d </option> <option value=e>e </option> </select> <select name="t"> <option value=a>a </option> <option value=b>b </option> <option value=c>c </option> <option value=d>d </option> <option value=e>e </option> </select>
------解决方案--------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> <script> function setqq(a){ document.getElementById(a).style.visibility="hidden"; } </script> </HEAD> <BODY> <div id="t1" style="visibility:visible"> <select onchange="setqq('t2')"> <option value=a>a </option> <option value=b>b </option> <option value=c>c </option> <option value=d>d </option> <option value=e>e </option> </select> </div> <br/> <div id="t2" style="visibility:visible"> <select onchange="setqq('t1')"> <option value=a>a </option> <option value=b>b </option> <option value=c>c </option> <option value=d>d </option> <option value=e>e </option> </select> </div> </BODY> </HTML>