聯動下拉菜單,分有數據庫和無數據庫兩種
http://go2aspcool.51.net/club/replan.php?boardid=1&planid=7101動態添加刪除option
http://go2aspcool.51.net/club/replan.php?boardid=1&planid=7519
http://go2aspcool.51.net/club/replan.php?boardid=1&planid=7101動態添加刪除option
http://go2aspcool.51.net/club/replan.php?boardid=1&planid=7519
http://expert.csdn.net/Expert/TopicView1.asp?id=1910441
<select onchange=chg(selectedIndex) name=a>
<option value=亚洲>亚洲
<option value=欧洲>欧洲
<option value=美洲>美洲
</select>
<select name=b onchange="r.value=value">
<option>请选择
</select>
<input name=r id=r>
</form>
<script>
var arr=[["中国","日本","朝鲜","新加坡"],["英国","法国","意大利"],["美国","加拿大","巴西"]]
function chg(i){
with(document.fm.b){
length=0;
for(j=0;j<arr[i].length;j++)
options.add(new Option(arr[i][j],arr[i][j]))
document.fm.r.value=value+document.fm.a.value
}
}
chg(0)
</script>
function check()
{
if(f1.d1.options[0].selected)
{
f1.d2.length=0 f1.d2.options.add(new Option("教师1","教师1"))
f1.d2.options.add(new Option("教师2","教师2"))
}
else if(f1.d1.options[1].selected)
{
f1.d2.length=0
f1.d2.options.add(new Option("学生1","学生1"))
f1.d2.options.add(new Option("学生2","学生2")) }}
</script>
</head><body><form name="f1" method="POST" action="--WEBBOT-SELF--">
<p><select size="1" name="d1" onchange="check()">
<option>教师</option>
<option>学生</option>
</select><select size="1" name="d2">
</select></p>
</form></body></html>
<html>
<head>
<script languang="javascript">
function mm()
{
var teacher=new Array(3);
var student=new Array(3);
var i;
teacher[0]="老师1";
teacher[1]="老师2";
teacher[2]="老师3";
student[0]="玫瑰";
student[1]="康乃馨";
student[2]="菊花";
while(s2.options.length != 0)
s2.remove(0);
if(s1.selectedIndex == 0)
for(i=0;i<teacher.length;i++)
s2.options.add(new Option(teacher[i],i));
else if(s1.selectedIndex == 1)
for(i=0;i<student.length;i++)
s2.options.add(new Option(student[i],i));
}
</script>
</head>
<body>
<select onChange=mm() name="s1">
<option value=1>老师
<option value=2>学生
</select>
<select name="s2">
</select>
</body>
</html>
我以前回答过类似的问题:
http://expert.csdn.net/Expert/topic/1901/1901586.xml?temp=.5769464