Asp三級聯(lián)動下拉菜單數(shù)據(jù)庫版(含源程序)_ASP教程
教程Tag:暫無Tag,歡迎添加,賺取U幣!
推薦:關(guān)于阻止灌水留言的一個方法(隨機生成的4位認(rèn)證碼)原理:在每次提交留言的時候,要輸入隨機生成的4位認(rèn)證碼. 以下代碼用在ASP 生成隨機4位數(shù): % dim key randomize timer key=Int((8999)*Rnd +1000) % 在表單里顯示: 認(rèn)證碼:%=key% input type=text name=rekey size=8 maxlength=4 input value=%=key
<%Option Explicit
’數(shù)據(jù)庫:
’location
’表1 loaction 所在的市 表
’ 字段
’ loactionid (主鍵)
’ loactionname 名字
’表2 district 所在的縣 表
’ 字段
’ locationid (主鍵)
’ districtid
’ districtname
’表3 village 所在的鄉(xiāng)鎮(zhèn) 表
’ 字段
’ districtid (主鍵)
’ villageid
’ villagename
%>
<html>
<head>
<title>List</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
dim conn
dim rs
dim sql
dim count
dim rs1
dim sql1
dim rs2
dim sql2
dim count2
dim connstr
connstr="DBQ="+server.mappath("db11.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
sql = "select * from district order by locationid asc"
set rs = conn.execute(sql)
%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%=trim(rs("districtname"))%>","<%= trim(rs("locationid"))%>","<%= trim(rs("districtid"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
set rs=nothing
%>
分享:asp生成HTM靜態(tài)列表分頁(含代碼,已測試成功)!--#include file=conn.asp-- htmlheadTITLE分頁測試/TITLELINK href=inc/style.css type=text/css rel=stylesheet/head %strHead=strHeadhtml strHead=strHeadhead strHead=strHeadTITLE分頁測試/TITLE strHead=strHeadLINK href=inc/style.cs
相關(guān)ASP教程:
- 相關(guān)鏈接:
- 教程說明:
ASP教程-Asp三級聯(lián)動下拉菜單數(shù)據(jù)庫版(含源程序)
。