小弟在开发一个系统php+mysql.目前只剩一下一个问题,问题测试页面如下
http://www.fashion.ntut..../test.php上方表单为销售资料上传用,预设报告数量(Report Number)为1,就是上传一笔资料,
而在Channel Type跟store name中我是使用二层动态下拉选单,store name会依据Channel Type不同而改变,会筛选出资料
问题在于当我选择将报告数量选择为2以上,就是上传多笔纪录的时候(上传多笔我用回圈达成),二阶动态选单的功能就失效了?只有第一笔报告正常
report no.2..等表单的动态选单都失效....如下图所示
动态选单我是利用DW的mxp做的
我的动态选单是当下拉class1选单时会将其分类的厂商名称动态过滤到c_name下拉选单中,
首先class1的程式码如下,当下拉选单改变时触发FilterAndPopulateSubList()
复制程式
<select name="class1[]" id="class1" onChange="WA_FilterAndPopulateSubList(c_name2_WAJA,MM_findObj('class1'),MM_findObj('C_name'),1,0,false,':')">
<option value="" <?php if (!(strcmp("", ((isset($_POST["class1"]))?$_POST["class1"]:"")))) {echo "selected=\"selected\"";} ?>>-Channel Type-</option>
FilterAndPopulateSubList()与MM_findObj()如下
复制程式
function WA_FilterAndPopulateSubList(thearray,sourceselect,targetselect,leaveval,bottomleave,usesource,delimiter) {
if (bottomleave > 0) {
leaveArray = new Array(bottomleave);
if (targetselect.options.length >= bottomleave) {
for (var m=0; m<bottomleave; m++) {
leavetext = targetselect.options[(targetselect.options.length - bottomleave + m)].text;
leavevalue = targetselect.options[(targetselect.options.length - bottomleave + m)].value;
leaveArray[m] = new Array(leavevalue,leavetext);
}
}
else {
for (var m=0; m<bottomleave; m++) {
leavetext = "";
leavevalue = "";
leaveArray[m] = new Array(leavevalue,leavetext);
}
}
}
startid = WA_UnloadList(targetselect,leaveval,0);
mainids = new Array();
if (usesource) maintext = new Array();
for (var j=0; j<sourceselect.options.length; j++) {
if (sourceselect.options[j].selected) {
mainids[mainids.length] = sourceselect.options[j].value;
if (usesource) maintext[maintext.length] = sourceselect.options[j].text + delimiter;
}
}
for (var i=0; i<thearray.length; i++) {
goodid = false;
for (var h=0; h<mainids.length; h++) {
if (thearray[i][0] == mainids[h]) {
goodid = true;
break;
}
}
if (goodid) {
theBox = targetselect;
theLength = parseInt(theBox.options.length);
theServices = thearray[i].length + startid;
var l=1;
for (var k=startid; k<theServices; k++) {
if (l == thearray[i].length) break;
theBox.options[k] = new Option();
theBox.options[k].value = thearray[i][l][0];
if (usesource) theBox.options[k].text = maintext[h] + WA_ClientSideReplace(thearray[i][l][1],"|WA|","'");
else theBox.options[k].text = WA_ClientSideReplace(thearray[i][l][1],"|WA|","'");
l++;
}
startid = k;
}
}
if (bottomleave > 0) {
for (var n=0; n<leaveArray.length; n++) {
targetselect.options[startid+n] = new Option();
targetselect.options[startid+n].value = leaveArray[n][0];
targetselect.options[startid+n].text = leaveArray[n][1];
}
}
for (var l=0; l < targetselect.options.length; l++) {
targetselect.options[l].selected = false;
}
if (targetselect.options.length > 0) {
targetselect.options[0].selected = true;
}
}
复制程式
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
已解决