标题:版主及各位老大帮忙看看这个啊.小弟实在想不出来了
只看楼主
Pp
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2004-6-29
 问题点数:0 回复次数:1 
版主及各位老大帮忙看看这个啊.小弟实在想不出来了

请教版主及各位大哥我在做一个表单时当选择了父栏目后希望能跳出子栏目.朋友告诉我要用到一段VB代码.我从别的网站上粘贴并修改了这样一段代码但是还是跳不出子栏目.网页错误提示是"document.frmAnnounce.classid为空或对象不存在"请各位帮小弟看看是怎么回事,小弟特急呀

<!--#include file="dbconn.inc"--> <% sql="select * from zxnclass order by nclassid asc" rs.open sql,conn,1,1

%> <html> <head> <title>无标题文档</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312">

这就是粘贴过来的VB代码<script language = "JavaScript"> var onecount; onecount=0; subcat = new Array(); <% count = 0 do while not rs.eof %> subcat[<%=count%>] = new Array("<%= trim(rs("Nclass"))%>","<%= trim(rs("classid"))%>","<%= trim(rs("Nclassid"))%>"); <% count = count + 1 rs.movenext loop rs.close %> onecount=<%=count%>;

function changelocation(locationid) { document.frmAnnounce.Nclassid.length = 0;

var locationid=locationid; var i; for (i=0;i < onecount; i++) { if (subcat[i][1] == locationid) { document.frmAnnounce.Nclassid.options[document.frmAnnounce.Nclassid.length] = new Option(subcat[i][0], subcat[i][2]); } } } </script>

</head>

<body bgcolor="#FFFFFF" text="#000000"> <form name="frmannounce" method="post" action="input_answer.asp"> <table width="75%" border="1" height="351" align="center"> <tr> <td width="11%" height="13">选择栏目</td> <td width="89%" height="13"> <% sql = "select * from zxclass" rs.open sql,conn,1,1 if rs.eof and rs.bof then response.write "请先添加栏目。" response.end else %> <select name="classid" onChange="changelocation(document.frmAnnounce.classid.options[document.frmAnnounce.classid.selectedIndex].value)" size="1"> <option selected value="">请选择栏目</option> <% do while not rs.eof %> <option value="<%=trim(rs("classid"))%>"><%=trim(rs("classname"))%></option> <% rs.movenext loop end if rs.close set rs = nothing conn.Close set conn = nothing %> </select> <select name="Nclassid" size="1"> </select> </td> </tr> <tr> <td width="11%" height="18">时间</td> <td width="89%" height="18"> <input type="text" name="textfield"> </td> </tr> <tr> <td width="11%" height="25">标题</td> <td width="89%" height="25"> <input type="text" name="textfield2"> </td> </tr> <tr> <td width="11%">内容</td> <td width="89%"> <textarea name="textfield3" cols="60" rows="13"></textarea> </td> </tr> </table> <p align="center"> <input type="submit" name="Submit" value="提交"> <input type="reset" name="Submit2" value="重写"> </p> </form> </body> </html>

搜索更多相关主题的帖子: 版主 老大 
2004-07-25 13:11
regedit
Rank: 5Rank: 5
等 级:贵宾
威 望:19
帖 子:950
专家分:0
注 册:2004-6-8
得分:0 
<option selected value="<%=trim(rs("classid"))%>"><%=trim(rs("class"))%></option> <% dim selclass selclass=rs("classid") rs.movenext do while not rs.eof %>

最新作品:百货品牌商品资讯第一门户([url]http://www./[/url]),欢迎交流
2004-07-26 14:45



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-3595-1-1.html




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

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