ASP二級分類聯動菜單
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<%
A = request.Form("anclassid")
B = request.Form("Nclassid")
if request.Form("Submit")="提交" then
response.Write "a="&A
response.Write "<br>b="&B
response.End()
end if
dim count
set rs=server.createobject("adodb.recordset")
'--------取出小類裏的數據,Nclassidorder:小類在大類裏的ID號
rs.open "select * from class order by id ",conn,1,1%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
<!---讀出數據存入數組,第一位:class_name是小類名稱,第二位:v_school是小類在大類裏的ID號,三位:小類ID----->
subcat[<%=count%>] = new Array("<%= trim(rs("class_name"))%>","<%= rs("v_school")%>","<%= rs("id")%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.myform.Nclassid.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{ //這句不是很理解
document.myform.Nclassid.options[document.myform.Nclassid.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
<body>
<table cellpadding="3" cellspacing="1" border="0" width="100%" class="tableBorder" align=center>
<tr height=25>
<th class="tableHeaderText" colspan=6 height=25>添加新商品</th>
</tr>
<tr>
<td class="forumRowHighlight" >
<table align=center>
<form name="myform" method="post" action="test.asp" OnSubmit="return checkkk()" >
<tr>
<td width="8%"> </td>
<td colspan="2">
<p>
<%
rs.open "select * from school order by school_id",conn,1,1
'-----------列出大類數據
if rs.eof and rs.bof then
response.write "請先添加欄目。"
response.end
else
%>
大類:
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.