⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 first.asp

📁 实现级联菜单的功能
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<%  
dim rs  
dim sql  
dim count  
set rs=server.createobject("adodb.recordset")  
sql= "select * from fb"  
rs.open sql,conn,1,1
%>  
<SCRIPT language="JavaScript">  
var onecount;  
onecount=0;  
subcat = new Array();  
<%  
count = 0  
do while not rs.eof   
%>  
subcat[<%=count%>] = new Array("<%= trim(rs("LabID"))%>","<%= trim(rs("CID"))%>");  
<%  
count = count + 1  
rs.movenext 
loop  
rs.close  
%>  
onecount=<%=count%>;  



function changelocation(locationid)  
{  
document.form1.cid.length = 0;   
var locationid=locationid;  
var i;  
for (i=0;i < onecount; i++)  
{  
if (subcat[i][0] == locationid)  
{ 
//document.write(subcat[i][1])
document.form1.cid.options[document.form1.cid.length] = new Option(subcat[i][1]);  
}   
}  
}   
</SCRIPT> 






<form name=form1 >  
省份 <%  
set rs=server.CreateObject("adodb.recordset")
sql = "select * from lab"  
rs.open sql,conn,1,1  
if rs.eof and rs.bof then  
response.write "请先添加省份。"  
response.end  
else  
%>  
<Select name="sid" onChange="changelocation(document.form1.sid.options[document.form1.sid.selectedIndex].value)" ><%   
do while not rs.eof  
%><OPTION selected value="<%=trim(rs("LabID"))%>"><%=trim(rs("labname"))%></OPTION>  
<%  
rs.movenext  
loop  
end if  
rs.close  
%>  
</Select> 
城市:<Select name="cid">  
<OPTION selected value="">==请选城市==</OPTION>  
</Select>  
</form>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -