1.��Դ��
2.vbèåç¼è¾ä»£ç ï¼ï¼ï¼ï¼
��Դ��
关于SELECT的菜源码无限联动菜单
index.asp
程序代码:
<html>
<head>
<title></title>
<meta content="text/html; charset=gb" http-equiv="content-type">
<style type="text/css"><!--
FONT{ font-size:px}
TD{ font-size:px}
A{ color:#}
A:hover{ color:#FF}
--></style>
<script language="Javascript" type="text/Javascript"><!--
function funOnload(){
document.all.list_file.src="jscript_city.asp?base=0&sele=0-&elem=Select";
}
//pBase级数,以0基,菜源码php源码存在漏洞的源码
//pSele是菜源码android 方向模拟源码<option 的value值
//pEle是下一级的表单名字
function chgSelect(pBase,pSele,pElem){
//当改变了一个列表之后。清除以后的菜源码智能答问系统源码列表的值。
for(i=parseInt(pElem.replace("Select",菜源码nginx 显示php源码""));i<=5;i++){
var tmp=""+i;
var pElem1=eval("document.Form1.Select"+tmp.substr(tmp.length-2));
pElem1.length=1;
pElem1.selectedIndex=0;
}
//JS用ASP得到数据库的数据来更新下级列表
document.all.list_file.src="jscript_city.asp?base="+pBase+"&sele="+pSele+"&elem="+pElem;
}
//--></script>
<script id="list_file" language="Javascript" type="text/Javascript" src=""></script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="2" text="#" onload="funOnload();">
<form name="Form1">
<select name="Select" onchange="chgSelect(1,this.options[this.selectedIndex].value,'Select')">
<option value="">省...</option>
</select>
<select name="Select" onchange="chgSelect(2,this.options[this.selectedIndex].value,'Select')">
<option value="">市...</option>
</select>
<select name="Select" onchange="chgSelect(3,this.options[this.selectedIndex].value,'Select')">
<option value="">县...</option>
</select>
<select name="Select" onchange="chgSelect(4,this.options[this.selectedIndex].value,'Select')">
<option value="">乡...</option>
</select>
<select name="Select">
<option value="">村...</option>
</select>
</form>
</body></html>
'jscript_city.asp
程序代码:
<%
' varBase 下拉菜单等级
' varSele 所选择下拉菜单项的数据库ID
' varElem 下一级的表单名称
varBase=Request.QueryString("base")
varSele=Left(Request.QueryString("sele"),InStr(Request.QueryString("sele"),"-")-1)
varElem=Request.QueryString("elem")
varDistName=""
varAutoID=""
Set conDB=Server.CreateObject("ADODB.CONNECTION")
conDB.Open "Driver={ Microsoft Access Driver (*.mdb)};DBQ="&Server.Mappath("db1.mdb")
sqlCommand="select * from table1 where filed1="&varBase&" and filed2="&varSele
Set rsRecord=conDB.Execute(sqlCommand)
While Not rsRecord.eof
varDistName=varDistName&chr()&rsRecord("filed3")&chr()
varAutoID=varAutoID&chr()&rsRecord("id")&chr()
rsRecord.movenext
If Not rsRecord.Eof Then
varDistName=varDistName&","
varAutoID=varAutoID&","
End If
Wend
Response.Write("var varDistName=new Array("&varDistName&")"&vbcrlf)
Response.Write("var varAutoID=new Array("&varAutoID&")"&vbcrlf)
Response.Write("var varElem=eval("&chr()&"document.Form1."&varElem&chr()&")"&vbcrlf)
Response.Write("varElem.length=varDistName.length+1;"&vbcrlf)
Response.Write("for(var i=0;i<varDistName.length;i++){ "&vbcrlf)
Response.Write(" varElem.options[i+1].text=varDistName;"&vbcrlf)
Response.Write(" varElem.options[i+1].value=varAutoID+'-'+varDistName;"&vbcrlf)
Response.Write("}"&vbcrlf)
Response.Write("varElem.selectedIndex=0;"&vbcrlf)
%>
db1.mdb
'-------------------------------------------------
福建 厦门 思明 黄厝 曾厝桉村
福建 泉州 丰泽 西湖 水头村
如上面的五级转成数据库为:
'-------------------------------
id filed1 filed2 filed3
1 0 0 福建
2 1 1 厦门
3 1 1 泉州
4 2 2 思明
5 3 4 黄厝
6 4 5 曾厝桉村
7 2 3 丰泽
8 3 7 西湖
9 4 8 水头村
'-------------------------------------------------
数据库说明:
id 自动编号
filed1 下拉菜单列表的等级(看级数。可以设置它的菜源码许愿墙源码web精度。是菜源码数字类型)
filed2 上一级的id号(用长整型吧)
filed3 这个就不用说了吧(文件。长度自己看情况)
本程序在IIS4+WINP+ACCESS下通过。菜源码
vbèåç¼è¾ä»£ç ï¼ï¼ï¼ï¼
..ç¹éçªä½ ç¶åå¨ å·¥å ·--èåç¼è¾å¨ ä¸æ·»å èåã
å°ä»¥ä¸å 容ä¿åå°è®°äºæ¬éï¼ç¶åæ´æ¹è¯¥è®°äºæ¬ææ¡£åç¼å为ï¼.frm
VERSION 5.
Begin VB.Form Form1
Caption = "Form1"
ClientHeight =
ClientLeft =
ClientTop =
ClientWidth =
LinkTopic = "Form1"
ScaleHeight =
ScaleWidth =
StartUpPosition = 3 'çªå£ç¼ºç
Begin VB.Menu menu
Caption = "æ件"
Begin VB.Menu menu1
Caption = "æå¼"
End
Begin VB.Menu menu2
Caption = "éåº"
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub menu1_Click()
Shell "cmd ",菜源码 1
End Sub
Private Sub menu2_Click()
End
End Sub