| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1932 人关注过本帖
标题:[求助]下拉框连动问题!!
取消只看楼主 加入收藏
bgya1979
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2006-3-8
收藏
 问题点数:0 回复次数:17 
[求助]下拉框连动问题!!

我做了一段下拉框连动的,但不知道怎么的第二个下拉框就是显示不出东西来!

还请各位大哥帮我查一下错!!

数据库 worker

字段 name (姓名)     bc  (班次)

代码如下:

<%set rs=server.createobject("adodb.recordset")
sql = "select * from worker"
rs.open sql,conn,1,1%>
<script language="javascript">
var second = new Array();
<%
i=0
do while not rs.eof
studentid=1+i
arrid=i
response.write("second["&arrid&"] = new Array('"&rs("bc")&"','studuent"&studentid&"','"&rs("name")&"');" & vbcrlf)
rs.movenext
i=i+1
loop
rs.close
%>
function changeFirstType(field,subfield,classid){
subfield.length = 0;
var classid=classid;
var i;
for (i=0;i < second.length; i++)
{
if (second[i][0] == classid)
{
subfield.options[subfield.length] = new Option(second[i][2], second[i][1]);
}
}
}
</script>

<form name=form method="post">
<SELECT id=FirstID onchange=javascript:changeFirstType(this,this.form.smallclassid,this.options[this.selectedIndex].value); name=bigclassid>
<OPTION value="甲班" selected>甲班</OPTION>
<OPTION value="乙班">乙班</OPTION>
<OPTION value="丙班">丙班</OPTION>
<OPTION value="丁班">丁班</OPTION>
<OPTION value="白班">白班</OPTION>
</SELECT>

<SELECT id=SecondID name=smallclassid> </SELECT>
</form>


请各个大哥帮个忙,查一下错给予指正!!

搜索更多相关主题的帖子: 数据库 连动 worker name 
2006-04-17 08:00
bgya1979
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2006-3-8
收藏
得分:0 

大哥!!不行呀!!还有错!!

2006-04-17 10:11
bgya1979
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2006-3-8
收藏
得分:0 
还是不行呀!!

哪位大哥帮我好好看看呀!
2006-04-18 09:27
bgya1979
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2006-3-8
收藏
得分:0 


<script language="javascript">
//班级成员列表
var second = new Array();
second[0] = new Array('甲班','studuent1','高新海 ');
second[1] = new Array('甲班','studuent2','王宝明 ');
second[2] = new Array('甲班','studuent3','庞杰 ');
second[3] = new Array('甲班','studuent4','陈冬立 ');
second[4] = new Array('乙班','studuent5','马晓东 ');
second[5] = new Array('乙班','studuent6','戴春堂 ');
second[6] = new Array('乙班','studuent7','石引明 ');
second[7] = new Array('乙班','studuent8','王保春 ');
second[8] = new Array('甲班','studuent9','李平 ');
second[9] = new Array('乙班','studuent10','韩利生 ');
second[10] = new Array('乙班','studuent11','刘义强 ');
second[11] = new Array('甲班','studuent12','李焕杰 ');
second[12] = new Array('甲班','studuent13','张锁 ');
second[13] = new Array('甲班','studuent14','李相敏 ');
second[14] = new Array('甲班','studuent15','谷士国 ');
second[15] = new Array('甲班','studuent16','杨金东 ');
second[16] = new Array('甲班','studuent17','湛海生 ');
second[17] = new Array('甲班','studuent18','侯胜田 ');
second[18] = new Array('甲班','studuent19','王建东 ');
second[19] = new Array('甲班','studuent20','张建国 ');
second[20] = new Array('甲班','studuent21','张卫国 ');
second[21] = new Array('甲班','studuent22','马建辉 ');
second[22] = new Array('甲班','studuent23','刘福春 ');
second[23] = new Array('甲班','studuent24','王兴光 ');
second[24] = new Array('甲班','studuent25','王长利 ');
second[25] = new Array('甲班','studuent26','关守国 ');
second[26] = new Array('甲班','studuent27','李利军 ');
second[27] = new Array('甲班','studuent28','于忠来 ');
second[28] = new Array('甲班','studuent29','魏永仓 ');
second[29] = new Array('甲班','studuent30','侯广峰 ');
second[30] = new Array('甲班','studuent31','曾昭君 ');
second[31] = new Array('甲班','studuent32','王群众 ');
second[32] = new Array('甲班','studuent33','王军 ');
second[33] = new Array('乙班','studuent34','王新波 ');
second[34] = new Array('乙班','studuent35','刘艳会 ');
second[35] = new Array('乙班','studuent36','王瑞军 ');
second[36] = new Array('乙班','studuent37','高存国 ');
second[37] = new Array('乙班','studuent38','李东 ');
second[38] = new Array('乙班','studuent39','高存联 ');
second[39] = new Array('甲班','studuent40','王进田 ');
second[40] = new Array('甲班','studuent41','曹平 ');
second[41] = new Array('甲班','studuent42','王广胜 ');
second[42] = new Array('甲班','studuent43','李连松 ');
second[43] = new Array('甲班','studuent44','吕峰 ');
second[44] = new Array('甲班','studuent45','张金 ');
second[45] = new Array('甲班','studuent46','杨茂军 ');
second[46] = new Array('甲班','studuent47','韩玉超 ');
second[47] = new Array('甲班','studuent48','尹春元 ');
second[48] = new Array('甲班','studuent49','陈英 ');
second[49] = new Array('甲班','studuent50','高友富 ');
second[50] = new Array('甲班','studuent51','李晓强 ');
second[51] = new Array('甲班','studuent52','康小利 ');
second[52] = new Array('甲班','studuent53','裴印江 ');
second[53] = new Array('甲班','studuent54','马德山 ');
second[54] = new Array('甲班','studuent55','尹卫民 ');
second[55] = new Array('甲班','studuent56','张德臣 ');
second[56] = new Array('甲班','studuent57','张国辉 ');
second[57] = new Array('甲班','studuent58','高海生 ');
second[58] = new Array('甲班','studuent59','佟福贵 ');
second[59] = new Array('甲班','studuent60','田忠杰 ');
second[60] = new Array('甲班','studuent61','李向宝 ');
second[61] = new Array('甲班','studuent62','史振良 ');
second[62] = new Array('甲班','studuent63','邓学刚 ');
second[63] = new Array('甲班','studuent64','李斌 ');
second[64] = new Array('甲班','studuent65','王连华 ');
second[65] = new Array('乙班','studuent66','张铁昌 ');
second[66] = new Array('乙班','studuent67','韩艳民 ');
second[67] = new Array('乙班','studuent68','朱玉明 ');
second[68] = new Array('乙班','studuent69','刘建华 ');
second[69] = new Array('乙班','studuent70','牟力生 ');
second[70] = new Array('乙班','studuent71','吴庆山 ');
second[71] = new Array('乙班','studuent72','杨立国 ');
second[72] = new Array('乙班','studuent73','李建营 ');
second[73] = new Array('乙班','studuent74','蔡小军 ');
second[74] = new Array('乙班','studuent75','高志华 ');
second[75] = new Array('乙班','studuent76','吴国峰 ');
second[76] = new Array('乙班','studuent77','刘金忠 ');
second[77] = new Array('乙班','studuent78','张国林 ');
second[78] = new Array('乙班','studuent79','潘永超 ');
second[79] = new Array('乙班','studuent80','荣成斌 ');
second[80] = new Array('乙班','studuent81','陈文强 ');
second[81] = new Array('乙班','studuent82','张绍斌 ');
second[82] = new Array('乙班','studuent83','马岗山 ');
second[83] = new Array('乙班','studuent84','杨玉来 ');
second[84] = new Array('乙班','studuent85','李田 ');
second[85] = new Array('乙班','studuent86','杨艳生 ');
second[86] = new Array('乙班','studuent87','李勇 ');
second[87] = new Array('乙班','studuent88','杨向民 ');
second[88] = new Array('乙班','studuent89','贾京平 ');
second[89] = new Array('乙班','studuent90','王力 ');
second[90] = new Array('乙班','studuent91','玄力军 ');
second[91] = new Array('乙班','studuent92','马振启 ');
second[92] = new Array('乙班','studuent93','程翠红 ');
second[93] = new Array('乙班','studuent94','郁秀勇 ');
second[94] = new Array('乙班','studuent95','黄玉 ');
second[95] = new Array('乙班','studuent96','张德生 ');
second[96] = new Array('乙班','studuent97','姜林喜 ');
second[97] = new Array('乙班','studuent98','吴建庭 ');
second[98] = new Array('乙班','studuent99','牟贡波 ');
second[99] = new Array('乙班','studuent100','潘玉峰 ');
second[100] = new Array('乙班','studuent101','赵大春 ');
second[101] = new Array('乙班','studuent102','温荣华 ');
second[102] = new Array('乙班','studuent103','宫万平 ');
second[103] = new Array('乙班','studuent104','姚志才 ');
second[104] = new Array('乙班','studuent105','魏锁文 ');
second[105] = new Array('乙班','studuent106','高振金 ');
second[106] = new Array('丙班','studuent107','周胜平 ');
second[107] = new Array('丙班','studuent108','孟令国 ');
second[108] = new Array('丙班','studuent109','张四利 ');
second[109] = new Array('丙班','studuent110','薄成文 ');
second[110] = new Array('丙班','studuent111','史成军 ');
second[111] = new Array('丙班','studuent112','董建保 ');
second[112] = new Array('丙班','studuent113','刘文江 ');
second[113] = new Array('丙班','studuent114','吕志军 ');
second[114] = new Array('丙班','studuent115','周宝刚 ');
second[115] = new Array('丙班','studuent116','顾福生 ');
second[116] = new Array('丙班','studuent117','曹永明 ');
second[117] = new Array('丙班','studuent118','周洪伟 ');
second[118] = new Array('丙班','studuent119','刑有志 ');
second[119] = new Array('乙班','studuent120','刘才 ');
second[120] = new Array('丙班','studuent121','王艳民 ');
second[121] = new Array('丙班','studuent122','许国成 ');
second[122] = new Array('丙班','studuent123','崔若伟 ');
second[123] = new Array('丙班','studuent124','彭玉海 ');
second[124] = new Array('丙班','studuent125','史庆伟 ');
second[125] = new Array('丙班','studuent126','徐国胜 ');
second[126] = new Array('丙班','studuent127','王贺才 ');
second[127] = new Array('丙班','studuent128','秘运涛 ');
second[128] = new Array('丙班','studuent129','杨瑞军 ');
second[129] = new Array('丙班','studuent130','姜利 ');
second[130] = new Array('丙班','studuent131','张忠强 ');
second[131] = new Array('丙班','studuent132','董立宁 ');
second[132] = new Array('丙班','studuent133','李松岳 ');
second[133] = new Array('丙班','studuent134','宋志刚 ');
second[134] = new Array('丙班','studuent135','刘成银 ');
second[135] = new Array('丙班','studuent136','韩树强 ');
second[136] = new Array('丙班','studuent137','蔡新和 ');
second[137] = new Array('丙班','studuent138','吕福士 ');
second[138] = new Array('丙班','studuent139','陈希树 ');
second[139] = new Array('丙班','studuent140','纪如 ');
second[140] = new Array('丙班','studuent141','刘振杰 ');
second[141] = new Array('丙班','studuent142','李艳军 ');
second[142] = new Array('丙班','studuent143','石文密 ');
second[143] = new Array('丙班','studuent144','张孝刚 ');
second[144] = new Array('丙班','studuent145','王志辉 ');
second[145] = new Array('丙班','studuent146','王宝山 ');
second[146] = new Array('丙班','studuent147','葛瑞发 ');
second[147] = new Array('丙班','studuent148','刘井文 ');
second[148] = new Array('丙班','studuent149','孙喜 ');
second[149] = new Array('丙班','studuent150','李增林
');
second[150] = new Array('丙班','studuent151','董双喜
');
second[151] = new Array('丁班','studuent152','卢善民
');
second[152] = new Array('丁班','studuent153','赵永利
');
second[153] = new Array('丁班','studuent154','郑子成
');
second[154] = new Array('丁班','studuent155','陶爱军
');
second[155] = new Array('丁班','studuent156','蔡仲合
');
second[156] = new Array('丁班','studuent157','张立新
');
second[157] = new Array('丁班','studuent158','戚岳员
');
second[158] = new Array('丁班','studuent159','唐坦
');
second[159] = new Array('丙班','studuent160','徐治利 ');
second[160] = new Array('丙班','studuent161','岑学礼
');
second[161] = new Array('丙班','studuent162','高闻利
');
second[162] = new Array('丁班','studuent163','刘来福
');
second[163] = new Array('丁班','studuent164','王琦
');
second[164] = new Array('丁班','studuent165','孟庆国
');
second[165] = new Array('丁班','studuent166','蔡万华
');
second[166] = new Array('丁班','studuent167','高振友
');
second[167] = new Array('丁班','studuent168','程春利
');
second[168] = new Array('丙班','studuent169','马富
');
second[169] = new Array('丙班','studuent170','董学良
');
second[170] = new Array('丙班','studuent171','张朋
');
second[171] = new Array('丁班','studuent172','孟祥营
');
second[172] = new Array('丁班','studuent173','袁树河
');
second[173] = new Array('丁班','studuent174','王连
');
second[174] = new Array('丁班','studuent175','刘旭东
');
second[175] = new Array('丁班','studuent176','张平
');
second[176] = new Array('丁班','studuent177','陈艳合
');
second[177] = new Array('丁班','studuent178','赵凤斌
');
second[178] = new Array('丁班','studuent179','于辉
');
second[179] = new Array('丁班','studuent180','唐平
');
second[180] = new Array('丁班','studuent181','吕明
');
second[181] = new Array('丙班','studuent182','刘岩军 ');
second[182] = new Array('丙班','studuent183','景增
');
second[183] = new Array('丁班','studuent184','王会利
');
second[184] = new Array('丁班','studuent185','侯广举
');
second[185] = new Array('丁班','studuent186','卜庆发
');
second[186] = new Array('丁班','studuent187','杨军
');
second[187] = new Array('丁班','studuent188','刘东瑞
');
second[188] = new Array('丁班','studuent189','高存军
');
second[189] = new Array('丁班','studuent190','王继国
');
second[190] = new Array('丁班','studuent191','于德利
');
second[191] = new Array('丁班','studuent192','孟祥龙
');
second[192] = new Array('丁班','studuent193','赵洪
');
second[193] = new Array('丁班','studuent194','郁红波
');
second[194] = new Array('丁班','studuent195','景合
');
second[195] = new Array('丁班','studuent196','张宝强
');
second[196] = new Array('丙班','studuent197','张占甲
');
second[197] = new Array('丙班','studuent198','刘林忠
');
second[198] = new Array('丁班','studuent199','刘建国
');
second[199] = new Array('丁班','studuent200','李宏力
');
second[200] = new Array('丁班','studuent201','王俊明
');
second[201] = new Array('丁班','studuent202','吴则顺
');
second[202] = new Array('丁班','studuent203','赵连忠
');
second[203] = new Array('丁班','studuent204','李玉清
');
second[204] = new Array('丁班','studuent205','张建民
');
second[205] = new Array('丁班','studuent206','刘汝茂
');
second[206] = new Array('丁班','studuent207','班冕
');
second[207] = new Array('丁班','studuent208','张进军
');
second[208] = new Array('丁班','studuent209','赵庆玉
');
second[209] = new Array('丁班','studuent210','程文红
');
second[210] = new Array('丁班','studuent211','杨秀文
');
second[211] = new Array('丁班','studuent212','邵美玉
');
second[212] = new Array('丁班','studuent213','李殿锁
');
second[213] = new Array('丁班','studuent214','李民
');
second[214] = new Array('丁班','studuent215','吴山
');

function changeFirstType(classid){
var classid=classid;
var i;
for (i=0;i < second.length; i++)
{
if (second[i][0] == classid)
{
document.form.smallclassid.options.length=1;
document.form.smallclassid.options[0].value=second[i][2];
document.form.smallclassid.options[0].text=second[i][2];
document.form.smallclassid.options[1].value=second[i][1];
document.form.smallclassid.options[1].text=second[i][1];
}
}
}
</script>

<form name=form method="post">
<SELECT id=bigclassid onchange=javascript:changeFirstType(this,this.form.smallclassid,this.options[this.selectedIndex].value); name=bigclassid>
<OPTION value="甲班" selected>甲班</OPTION>
<OPTION value="乙班">乙班</OPTION>
<OPTION value="丙班">丙班</OPTION>
<OPTION value="丁班">丁班</OPTION>
<OPTION value="白班">白班</OPTION>
</SELECT>
<SELECT id=smallclassid name=smallclassid>
<option></option>
</SELECT>

</form>

2006-04-18 09:38
bgya1979
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2006-3-8
收藏
得分:0 
运行后您的这段代码后在第二个下拉框中只显示最后一个人名!!
2006-04-18 10:17
bgya1979
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2006-3-8
收藏
得分:0 

我的意思是从第一个下拉框选择完班次后,从数据库中查找,在第二个下拉框中将所有所选班次的人员全部列出!

2006-04-18 10:30
bgya1979
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2006-3-8
收藏
得分:0 
是这个效果!!那asp代码我该怎么改呀!
2006-04-18 10:49
bgya1979
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2006-3-8
收藏
得分:0 

问一下,为什么我改完了运行后显示不出来,而且还有错!

行: 153

字符: 49

错误: 未结束的字符串常量

代码: 0

URL: http://10.9.3.55/jwgl/bb.asp



行: 308

字符: 1

错误: 缺少对象

代码: 0

URL: http://10.9.3.55/jwgl/bb.asp



行: 308

字符: 1

错误: 缺少对象

代码: 0

URL: http://10.9.3.55/jwgl/bb.asp

2006-04-18 11:06
bgya1979
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2006-3-8
收藏
得分:0 
asp代码一共才53行!!



网页代码的153行!

second[149] = new Array('丙班','studuent150','李增林

154行
');

网页代码的308行

<SELECT id=bigclassid onchange=changeFirstType(this.options[this.selectedIndex].value);
309行
name=bigclassid>
2006-04-18 11:15
bgya1979
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2006-3-8
收藏
得分:0 
问题依旧
2006-04-18 11:42
快速回复:[求助]下拉框连动问题!!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.030900 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved