菜单级联问题,着急中(50分)

  • 主题发起人 enjoywork44
  • 开始时间
E

enjoywork44

Unregistered / Unconfirmed
GUEST, unregistred user!
本已实现了菜单级联问题,即根据前一个菜单的选择,后面的菜单从数据库提取相应的内容,但是现在想实现的时后面两个菜单都要进行相应的提取,不知道如何做?初接触此领域,请大侠们多赐教,谢谢
原有的代码如下,正常运行
<%
dim rs
dim sql
dim count
set rs=server.createobject(&quot;adodb.recordset&quot;)
sql = &quot;select * from projecttotal &quot;
rs.open sql,conn,1,1
%>
<SCRIPT language=&quot;JavaScript&quot;>
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do
while not rs.eof
%>
subcat[<%=count%>] = new Array(&quot;<%= trim(rs(&quot;pjy&quot;))%>&quot;,&quot;<%= trim(rs(&quot;xmdm&quot;))%>&quot;,&quot;<%= trim(rs(&quot;xmmc&quot;))%>&quot;);
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
do
cument.form1.pjy.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount;
i++)
{
if (subcat[1] == locationid)
{
do
cument.form1.pjy.options[document.form1.pjy.length] = new Option(subcat[0], subcat[0]);
}
}
}
根据自己的理解,又在后面添加了xmmc这个菜单项,结果提示错误
<%dim rs
dim sql
dim count
set rs=server.createobject(&quot;adodb.recordset&quot;)
sql = &quot;select * from projecttotal &quot;
rs.open sql,conn,1,1%>
<SCRIPT language=&quot;JavaScript&quot;>
var onecount;
onecount=0;
subcat = new Array();
<% count = 0
do
while not rs.eof %>
subcat[<%=count%>] = new Array(&quot;<%= trim(rs(&quot;pjy&quot;))%>&quot;,&quot;<%= trim(rs(&quot;xmdm&quot;))%>&quot;,&quot;<%= trim(rs(&quot;xmmc&quot;))%>&quot;);
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{ do
cument.form1.pjy.length = 0;
do
cument.form1.xmmc.length = 0;

var locationid=locationid;
var i;
for (i=0;i < onecount;
i++)
{
if (subcat[1] == locationid)
{ do
cument.form1.pjy.options[document.form1.pjy.length] = new Option(subcat[0], subcat[0]);
document.form1.xmmc.options[document.form1.xmmc.length] = new Option(subcat[0], subcat[0]);
}
}
}
 
我觉得是xmmc字段的问题,那个字段是文本格式,也就是记录好多标点符号,会不是标点符号产生的影响或者是字段记录和数组数据类型不一致,(经调试, <%= trim(rs(&quot;xmdm&quot;))%>语句产生错误),用其他字段都没有问题,等待中,谢谢
 
下载个现成的研究一下
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
819
SUNSTONE的Delphi笔记
S
顶部