求救,请大家帮帮忙!看看!

Python/PHP/Perl 开发与设计
回复
头像
lionel1022
帖子: 28
注册时间: 2007-06-22 11:41
送出感谢: 0
接收感谢: 0

求救,请大家帮帮忙!看看!

#1

帖子 lionel1022 » 2007-11-09 16:24

各位高手,小弟在网上下载了一段下拉菜单的代码,是三级联动菜单,我现在想改成四级的,请各位帮助改改!谢谢!!!!

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script language="javascript">
var DeparmentCount; //三级联动菜单代码
DeparmentCount = 0;
var DivisionCount;
DivisionCount = 0;
var SpecialityCount;
SpecialityCount = 0

Department = new Array();
Division = new Array();
Speciality = new Array();

Division[0] = new Array("ccddd","13","100");

Division[1] = new Array("cc","14","101");

Division[2] = new Array("cczz","14","102");

Division[3] = new Array("sdfgsdfg","14","103");

Division[4] = new Array("asdasdf","14","104");

Division[5] = new Array("zxcvzxcv","14","106");

Division[6] = new Array("zxcvzv","2","107");

Division[7] = new Array("zxcvzxcv","13","108");

Division[8] = new Array("电视新闻系","2","4");

Division[9] = new Array("电视摄影系","2","5");

Division[10] = new Array("教研室","3","6");

Division[11] = new Array("机房","3","7");

Division[12] = new Array("办公室","3","8");

Division[13] = new Array("zxcv","14","105");

Division[14] = new Array("通信工程系","1","1");

Division[15] = new Array("电子信息工程系","1","2");

Division[16] = new Array("科学艺术系","1","3");

Division[17] = new Array("aaaa","15","109");

DivisionCount = 18;

Speciality[0] = new Array("ertwert","101","100");

Speciality[1] = new Array("阿阿阿","102","101");

Speciality[2] = new Array("万维网","102","1110");

Speciality[3] = new Array("asdf","100","103");

Speciality[4] = new Array("新闻评论","4","1");

Speciality[5] = new Array("网络新闻","4","2");

Speciality[6] = new Array("多媒体技术","1","3");

Speciality[7] = new Array("艺术摄影","5","4");

Speciality[8] = new Array("kkkk","109","104");

SpecialityCount = 9;

function changeDepartment(DepartmentId){
document.submit.Switch.value="false";
document.submit.division.length = 0;
var DepartmentId = DepartmentId;
var i;
for (i=0;i < DivisionCount; i++){
if (Division[1] == DepartmentId){
document.submit.division.options[document.submit.division.length] = new Option(Division[0], Division[2]);
}
}
changeDivision(document.submit.division.value);
}

function changeDivision(DivisionId){
document.submit.Switch.value="false";
document.submit.speciality.length = 0;
var DivisionId = DivisionId;
var i;
for (i=0;i < SpecialityCount; i++){
if (Speciality[1] == DivisionId){
document.submit.speciality.options[document.submit.speciality.length] = new Option(Speciality[0], Speciality[2]);
}
}
if(document.submit.speciality.length!=0){
document.submit.speciality.style.visibility = 'visible';
}
else{
document.submit.speciality.style.visibility = 'hidden';
}
}

function initialSelect(){
changeDepartment(document.submit.department.options[document.submit.department.selectedIndex].value);
}
</script>
</head>

<body onload="initialSelect();">
<form name="submit">
<select name="department" size="1" id="department" style="width:5%" onChange="changeDepartment(document.submit.department.options[document.submit.department.selectedIndex].value)">

<option value="2">电视与新闻学院</option>

<option value="3">计算中心</option>

<option value="1">工程学院</option>

<option value="13">fff</option>

<option value="14">gdsf</option>

<option value="15">zxcef</option>

</select>

<select name="division" size="1" id="division" onChange="changeDivision(document.submit.division.options[document.submit.division.selectedIndex].value)">
</select>

<input type="hidden" name="Switch" value="false">

<select name="speciality" size="1">
</select>
</form>
</body>
</html
回复

回到 “Python/Php/Perl”