两个下拉菜单互动代码有问题,不能互动!
大家仔细帮我看一看到底哪里有问题?
<!--#include file="_SysLinks.asp" -->
<%
dim rs
dim sql
dim count
set rs=server.createobject("adodb.recordset")
sql = "select * from _Web_Data_Small_Class order by class_id asc"
rs.open sql,conn,1,1
%>
<?xml version="1.0" encoding="gb2312"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=SoftName%></title>
<link href="_Include/style.css" rel="stylesheet" type="text/css" />
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("Small_class"))%>","<%= trim(rs("Topic_id"))%>","<%= trim(rs("class_id"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.myform.class_id.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[1] == locationid)
{
document.myform.class_id.options[document.myform.class_id.length] = new Option(subcat[0], subcat[2]);
}
}
}
</script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="16%"> </td>
<td width="84%" align="right"></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="4" cellpadding="0">
<form name="myform" method="post" action="_Xwsjgl_Small_Class_AddResult.asp" onsubmit="return CheckData();">
<tr bgcolor="#FAFAFA">
<td align="right">大类别预览:</td>
<td>
<%
sql = "select * from _web_data_Big_class"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "请先添加栏目。"
response.end
else
%>
<select name="classid" onChange="changelocation(document.myform.classid.options[document.myform.classid.selectedIndex].value)" size="1">
<option selected value="<%=trim(rs("Topic_id"))%>"><%=trim(rs("Big_class"))%></option>
<% dim selclass
selclass=rs("Topic_id")
rs.movenext
do while not rs.eof
%>
<option value="<%=trim(rs("Topic_Id"))%>"><%=trim(rs("Big_class"))%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
</td>
</tr>
<tr bgcolor="#FAFAFA">
<td align="right">小类别预览:</td>
<td> <select name="Nclassid">
<%sql="select * from _Web_Data_Small_class where Topic_id="&selclass
rs.open sql,conn,1,1
if not(rs.eof and rs.bof) then
%>
<option selected value="<%=rs("class_ID")%>"><%=rs("Small_class")%></option>
<% rs.movenext
do while not rs.eof%>
<option value="<%=rs("class_ID")%>"><%=rs("Small_class")%></option>
<% rs.movenext
loop
end if
rs.close
set rs = nothing
conn.Close
set conn = nothing
%>
</select>
</td>
</tr>
<tr bgcolor="#FAFAFA">
<td width="31%" align="right">用户帐号:</td>
<td width="69%"><input name="Userid" type="text" class="form_1" id="Userid" value="<%=Session("userid")%>" size="60" readonly style="color:#666666;background:#f0f0f0" ></td>
</tr>
<tr bgcolor="#FAFAFA">
<td align="right">类型名称:</td>
<td><input name="DataClass" type="text" class="form_1" id="DataClass" size="60"></td>
</tr>
<tr bgcolor="#FAFAFA">
<td align="right"> </td>
<td><font color="#FF0000">注:类型名称最好为四个字!如"工作动态"</font></td>
</tr>
<tr bgcolor="#FAFAFA">
<td align="right"> </td>
<td> </td>
</tr> 作者:
xuyaoairen 时间: 2006-3-25 15:27
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
strScript="<script language = JavaScript>"
strScript=strScript+"var onecount;"
strScript=strScript+"onecount=0;"
strScript=strScript+"subcat = new Array();"
dim rs3,x,Bclass
set rs3=server.createobject("adodb.recordset")
sql="select * from Small_Class"
rs3.open sql,myConn
x=0
do while not rs3.eof
strScript=strScript+"subcat["&x&"] = new Array('"&rs3("Bclass")&"','"&rs3("Aclass")&"');"
rs3.movenext
x=x+1
loop
strScript=strScript+"onecount=150;"