Ajax Two-Level linkage menu

Source: Internet
Author: User
Tags trim

<!doctype HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/ Xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title>ajax level Two Linkage menu </title>
<script language= "Web Effects" >
/*--------------------------------------------------------------------
*
* Create a XMLHTTP instance
*return object is successfully created to return a XMLHTTP instance, otherwise it returns false
*
*--------------------------------------------------------------------
*/
function Createajax () {
var xmlhttp;
Try
{
XMLHTTP = new ActiveXObject ("Microsoft.XMLHTTP"); How IE is created
}
catch (E)
{
Try
{
XMLHTTP = new XMLHttpRequest (); How to create a browser such as FF
}
catch (E)
{
XMLHTTP = false; Creation failed, return false
}
}
return XMLHTTP; Return XMLHTTP Instance
}
function Getoid (IDS,SID) {
var xmlhttp = Createajax ();
var urllink = ' list10.asp?oid= ' +ids+ ' &sid= ' +sid+ ' &n= ' +math.random () + ';
if (XMLHTTP) {
Xmlhttp.open (' Get ', urllink,true);
Xmlhttp.onreadystatechange=function () {
if (xmlhttp.readystate = = 4) {//client complete request
if (Xmlhttp.status = = 200) {//server-side completes processing and returns data
var responsetext = Xmlhttp.responsetext;
if (ResponseText = = "") {//service returned the error message
Alert ("Yes");
smclass.innerhtml = ResponseText;
}else{
Alert ("No");
smclass.innerhtml = ResponseText;
}
}else{
smclass.innerhtml = ' Server returns exception ... '//server exception
}
}else{
smclass.innerhtml = ' Loading data ... '//prompting information when request is incomplete
}
}
Xmlhttp.send (null);//Send request to Server
}else{
smclass.innerhtml = ' Your browser does not support or not enable xmlhttp! '; /Create unsuccessful
}
}
</script>

<body>
</body>

<!--#include file= "conn.asp"-->
<%
Response.Charset = "gb2312"
Dim outstr,ors,osql
OID = Request ("OID")
SID = Request ("Sid")
if (oid = "" or IsNull (OID)) then
outstr = ""
Else
outstr = "<select name=" "Smid" ">"
outstr = outstr & "<option value=" "0" "> Do not specify small class </option>"
osql = "Select Id,otitle,opx,oid from news_cls where oid =" &oid& "
osql = osql & "ORDER by OPX ASC"
Set ors = Conn.execute (osql)
if (ors.eof and ORS.BOF) then
outstr = outstr & "<option value=" "0" "> No small Class </option>"
Else
Do as not ors.eof
If trim (SID) = Trim (ors (0)) Then
outstr = outstr & "<option value=" "&ors (0) &" "Selected>" &ors (1) & "</option>"
Else
outstr = outstr & "<option value=" "&ors (0) &" ">" &ors (1) & "</option>"
End If
Ors.movenext
Loop
End If
outstr = outstr & "</select>"
Set ors = Nothing
End If
Response.Write (OUTSTR)
' Database Tutorial Connection file


Dim mdb,conn,connstr
mdb= "Database/adsl.mdb"
Set conn = Server.CreateObject ("Adodb.connection")
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & Server.MapPath (MDB) & ""
Conn.Open ConnStr
Sub Closeconn ()
If IsObject (conn) Then
Conn.close
Set conn = Nothing
End If
End Sub

' Table structure

ID otitle oid Opath ofile opx
1 Yunnan Line 0 Yunnanxianlu index.shtml 1
2 Yunnan Province Tourism 1 yunnanshenglvyou index.shtml 2
3 Domestic Tourism 1 guonalvyou index.shtml 1
4 Outbound Travel 1 chujinglvyou index.shtml 3
5 into Yunnan 0 Zoujinyunnan index.shtml 2
6 Yunnan Famous 5 Yunnantutemingchan index.shtml 1
7 Yunnan Ethnic Minority 5 Yunnanshaoshuminzu index.shtml 2
8 Yunnan 18 Strange 5 Yunnanshibaguaicha index.shtml 3
%>

SOURCE Download Address

Http://down.111cn.net/down/code/asp/2010/0927/20955.html

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.