谁有JSP的三级联动的源码呀?
我现在急用``
谢谢~!
<script type="text/javascript">
var count = 0;
var count1 = 0;
var dataArray = new Array();
var dataArray1 = new Array();
function setpic(filepath){
//alert(filepath);
document.all.fileimg.src = filepath;
}
//把数组数据添加到select里面
function getCheckBox(){
for(var i=0; i<dataArray.length; i++){
document.all.father_classid.options[document.all.father_classid.length] =
new Option(dataArray[i][0],dataArray[i][1]);
}
}
//把数组数据添加到select1里面
function getCheckBox1(){
for(var i=0; i<dataArray1.length; i++){
document.all.child_classid.options[document.all.child_classid.length] =
new Option(dataArray1[i][0],dataArray1[i][1]);
}
}
//添加select数据
function getDataArray(classid, classname){
//alert(classid);
dataArray[count]=new Array(classid, classname);
count = count+1;
}
//添加select1数据
function getDataArray1(classid1, classname1){
//alert(classid1);
dataArray1[count1]=new Array(classid1, classname1);
count1 = count1+1;
}
//选择当前的select
function selectCheck(classid){
var length = document.all.father_classid.length;
for(var i=0; i<length; i++){
if(document.all.father_classid.options[i].value == classid){
document.all.father_classid.selectedIndex = i;
break;
}
}
}
//选择当前的select1
function selectCheck1(classid1){
var length = document.all.child_classid.length;
for(var i=0; i<length; i++){
if(document.all.child_classid.options[i].value == classid1){
document.all.child_classid.selectedIndex = i;
break;
}
}
}
//取出当前的大类的value值
function getValue(){
//alert(this.options[this.selectedIndex].value);
return document.all.father_classid.options[document.all.father_classid.selectedIndex].value;
}
//取出当前的小类的value值
function getValue1(){
//alert(this.options[this.selectedIndex].value);
return document.all.child_classid.options[document.all.child_classid.selectedIndex].value;
}
function setHiddenClass(){
document.all.classid.value = getValue();
document.all.nclassid.value = getValue1();
}
</script>
____________________________________________________________________
<tr>
<td>
大类分类
</td>
<td>
<c:forEach var="artClasses" items="${sessionScope.listArtClasses}">
<script>
getDataArray('${artClasses.classname }', '${artClasses.classid }');
</script>
</c:forEach>
<select name="father_classid" id="father_classid" style="width:120px;" onchange="location='ArtAction?task=nclasses&classid='+getValue();"></select>
<script>getCheckBox();</script>
<script>selectCheck('${art.art_classid }');</script>
</td>
</tr>
<tr>
<td>
小类分类
</td>
<td>
<c:forEach var="artNClasses" items="${listArtNClasses}">
<script>
getDataArray1('${artNClasses.classname }', '${artNClasses.classid }');
</script>
</c:forEach>
<select name="child_classid" id="child_classid" style="width:120px;" ></select>
<script>getCheckBox1();</script>
<script>selectCheck1('${art.art_nclassid }');</script>
</td>
</tr>
__________________________________________
希望能看懂........