ASP Dynamic Cascading Menu Code _ Application Tips
Source: Internet
Author: User
JS script:
<%
Dim rs
Dim sql
Dim count
Dim rs1
Dim sql1
sql = "SELECT * from Region ORDER by ZoneID ASC"
Set rs = Server.CreateObject ("Adodb.recordset")
Rs.Open sql,conn,1,3
%>
<script language = "JavaScript" >
var Onecount;
onecount=0;
subcat = new Array ();
<%
Count = 0
Do as not rs.eof
%>
SUBCAT[<%=COUNT%>] = new Array ("<%= Trim (rs (" Regionname "))%>", "<%= Trim (rs (" ZoneID "))%>", "<%= Trim (RS ("RegionID"))%> ");
<%
Count = Count + 1
Rs.movenext
Loop
Rs.close
Set rs=nothing
%>
onecount=<%=count%>;
function Changelocation (ZoneID)
{
document.myform.region.length = 0;
var Zoneid=zoneid;
var i;
Document.myform.region.options[0] = new Option ('-Region--', ');
For (I=0;i < onecount; i++)
{
if (subcat[i][1] = = ZoneID)
{
Document.myform.region.options[document.myform.region.length] = new Option (subcat[i][0], subcat[i][2]);
}
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service