- 精品下载 | 实用查询 | 词典查询 | 桌面壁纸 | 网址 | 笑话 | FLASH频道 | 天气文章资讯 | 站长工具 | 证件办理 | 闪字生成 | 广告代码 | 在线手册 | 有问必答
您现在的位置: 蓝派网 >> 文章中心 >> 网络编程 >> ASP >> 正文
站内文章搜索:           

三级联动下拉菜单ASP代码

作者:佚名    文章来源:网络转载    更新时间 :2007-11-26 0:59:04
以下是代码片段:
//subval[0] = new Array('10','单数','1','=1')
<%
howmanygroupss=0
%>
<%
While (NOT C03.EOF)
%>
subval[<%=howmanygroupss%>] = new Array('<%=(C03.Fields.Item("t_type1").Value)%>','<%=(C03.Fields.Item("t_type2").Value)%>','<%=(C03.Fields.Item("t_name").Value)%>','<%=(C03.Fields.Item("t_typeid").Value)%>')
  <%howmanygroupss=howmanygroupss+1%>
  <%
  C03.MoveNext()
Wend
If (C03.CursorType > 0) Then
  C03.MoveFirst
Else
  C03.Requery
End If
%>
//subval[数组] = new Array('一级的值','二级的值','三级标签','三级的值')

第二部分

改成

修改后代码:

以下是代码片段:

document.form2.s2.length = 0;
document.form2.s2.options[0] = new Option('==请选择==','');
//document.form2.s2.options[1] = new Option('选择单数','单数');
<%
howmanygroups=0
%>
  <%
While (NOT C02.EOF)
%>
document.form2.s2.options[<%=howmanygroups%>] = new Option('<%=(C02.Fields.Item("t_name").Value)%>','<%=(C02.Fields.Item("t_typeid").Value)%>');
  <%howmanygroups=howmanygroups+1%>
  <%
  C02.MoveNext()
Wend
If (C02.CursorType > 0) Then
  C02.MoveFirst
Else
  C02.Requery
End If
%>

document.form2.s3.length = 0;
document.form2.s3.options[0] = new Option('==请选择==','');

完整代码改成如下

以下是代码片段:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/ddasbae.asp" -->
<%
Dim C01
Dim C01_numRows

Set C01 = Server.CreateObject("ADODB.Recordset")
C01.ActiveConnection = MM_ddasbae_STRING
C01.Source = "SELECT * FROM t_type1"
C01.CursorType = 0
C01.CursorLocation = 2
C01.LockType = 1
C01.Open()

C01_numRows = 0
%>
<%
Dim C02
Dim C02_numRows

Set C02 = Server.CreateObject("ADODB.Recordset")
C02.ActiveConnection = MM_ddasbae_STRING
C02.Source = "SELECT * FROM t_type2"
C02.CursorType = 0
C02.CursorLocation = 2
C02.LockType = 1
C02.Open()

C02_numRows = 0
%>
<%
Dim C03
Dim C03_numRows

Set C03 = Server.CreateObject("ADODB.Recordset")
C03.ActiveConnection = MM_ddasbae_STRING
C03.Source = "SELECT * FROM t_type3"
C03.CursorType = 0
C03.CursorLocation = 2
C03.LockType = 1
C03.Open()

C03_numRows = 0
%><!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">
<meta name="Author" contect"thousymo">
<title>无标题文档</title>
</head>

<body>
<!-- 三级联动 Start -->

<script language="javascript">
<!--

var subval = new Array();
//subval[0] = new Array('10','单数','1','=1')
<%
howmanygroupss=0
%>
<%
While (NOT C03.EOF)
%>
subval[<%=howmanygroupss%>] = new Array('<%=(C03.Fields.Item("t_type1").Value)%>','<%=(C03.Fields.Item("t_type2").Value)%>','<%=(C03.Fields.Item("t_name").Value)%>','<%=(C03.Fields.Item("t_typeid").Value)%>')
  <%howmanygroupss=howmanygroupss+1%>
  <%
  C03.MoveNext()
Wend
If (C03.CursorType > 0) Then
  C03.MoveFirst
Else
  C03.Requery
End If
%>
//subval[数组] = new Array('一级的值','二级的值','三级标签','三级的值')

function changeselect2()
{
document.form2.s2.length = 0;
document.form2.s2.options[0] = new Option('==请选择==','');
//document.form2.s2.options[1] = new Option('选择单数','单数');
<%
howmanygroups=0
%>
  <%
While (NOT C02.EOF)
%>
document.form2.s2.options[<%=howmanygroups%>] = new Option('<%=(C02.Fields.Item("t_name").Value)%>','<

上一页  [1] [2] [3] 下一页

 
【相关文章:】
没有相关文章

发表评论】【打印此文】【关闭窗口】【点击数:
★好玩的休闲小游戏★
网友评论:
数据载入中,请稍后……