<font id="vh7td"></font>

      <rp id="vh7td"></rp>

      <address id="vh7td"></address>
      <em id="vh7td"><i id="vh7td"></i></em>

          <mark id="vh7td"><noframes id="vh7td">
          <font id="vh7td"></font>
            新聞建站cms系統、政府cms系統定制開發

            廣州網站建設公司-閱速公司

            asp.net新聞發布系統、報紙數字報系統方案
            /
            http://www.goldexpectations.com/
            廣州網站建設公司
            您當前位置:首頁>ASP.NET MVC

            ASP.NET MVC

            Ajax+asp實現三級聯動

            發布時間:2009/4/21 9:56:35  作者:  閱讀:1561  

            廣告:阿里云采購優惠專區

            1.顯示頁面源碼:
            <%@LANGUAGE="VB" CODEPAGE="936"%>
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml">
            <head>
            < http-equiv="Content-Type" content="text/html; charset=gb2312" />
            <title>產品添加</title>
            <link href="/images/haocss.css" rel="stylesheet" type="text/css" />
            < language="Java" src="/js/Prototype.js" type="text/Java"></>
            < language="java" type="text/java">
            resetclass2()
            {
            form1.pclass2.length = 0;
            form1.pclass2.options[0] = new Option("二級分類","");
            form1.pclass2.options[0].selected=true;}
            resetclass1()
            {
            form1.pclass1.length=0;
            form1.pclass1.options[0] = new Option("請選擇分類","");
            }
            resetclass3()
            {
            form1.pclass3.length = 0;
            form1.pclass3.options[0] = new Option("三級分類","");
            form1.pclass3.options[0].selected=true;}

            Start_***(url,Action)
            {
            var myAjax = new Ajax.Request(url,{method:'get',parameters:Action,onComplete:***_Receive });
            }
            ***_Receive(OriginalRequest)
            {
            if (OriginalRequest.responseText!= "" )
            {
            var temp;
            var temp1
            var temp2
            var temp3
            temp=OriginalRequest.responseText;
            temp3=temp.substring(temp.indexOf(",")+1,temp.length)
            temp=temp.substring(0,temp.indexOf(","))
            var classtemp = new Array;
            classtemp=temp.split("-");
            var j=1
            getElementById(temp3).options[0] = new Option("請選擇","")
            for (i=0;i<classtemp.length-1;i++)
            {
            temp1="";
            temp2="";
            temp1= classtemp[i].substring(0,classtemp[i].indexOf("$"));
            temp2= classtemp[i].substring(classtemp[i].indexOf("$")+1,classtemp[i].length);

            getElementById(temp3).options[j] = new Option(temp1,temp2);
            j=j+1
            }

            }
            }
            </>
            </head>
            <body>
            <div id=content>
            <form name="form1" action="" method="post">
            <h2>產品添加</h2>
            <div id="hao"></div>
            <ul>
            <li><div class=addleft>產品分類:</div><div class=addright> 一級分類:<select onchange="Start_***('class/pclass_make.asp','formname=form1&bigclass=two&idname=pclass2&class1id='+this.options[this.selectedIndex].);" name="pclass1" id="pclass1" ><OPTION ="" ></OPTION></select> 二級分類:<select name="pclass2" id="pclass2" onchange="Start_***('class/pclass_make.asp','formname=form1&bigclass=three&idname=pclass3&class2id='+this.options[this.selectedIndex].);" ><OPTION ="" ></OPTION></select> 三級分類:<select name="pclass3" id="pclass3" ><OPTION ="" ></OPTION></select></div></li>
            <li><div class=addleft>產品名稱:</div><div class=addright> <input name="pname" type="text" ="" /></div></li>
            <li><div class=addleft>產品規格:</div><div class=addright> <input name="psize" type="text" ="" /></div></li>
            <li><div class=addleft>產品說明:</div><div class=addright> <input name="pcontent" type="text" ="" /></div></li>
            <li><div class=addleft>產品備注:</div><div class=addright> <input name="premarks" type="text" ="" /></div></li>
            <li><div class=addleft>產品價格:</div><div class=addright> <input name="price" type="text" ="" /></div></li>
            <li><div class=addleft>小圖片:</div><div class=addright> <input name="pic_s" type="text" ="" /></div></li>
            <li><div class=addleft>大圖片:</div><div class=addright> <input name="pic_b" type="text" ="" /></div></li>
            </ul>
            </form>
            </div>
            < language=JAVA>resetclass1();resetclass2();resetclass3();Start_***('class/pclass_make.asp','formname=form1&bigclass=one&idname=pclass1');</>
            </body>
            </html>

            2.后臺頁面處理源碼:

            <%@LANGUAGE="VB" CODEPAGE="65001"%>
            <%
            if Session("adminuser")="" then
            Response.Redirect "../login.asp"
            end if%>
            <!-- #i nclude file="../../inc/conn.asp" -->
            <!-- #i nclude file="../../inc/.asp" -->
            <%
            dim class1id
            dim class2id
            dim class3id
            dim formname
            dim bigclass
            dim idname
            dim content
            content=""
            formname=haorep(request.querystring("formname"))
            class1id=haorep(request.querystring("class1id"))
            class2id=haorep(request.querystring("class2id"))
            class3id=haorep(request.querystring("class3id"))
            bigclass=haorep(request.querystring("bigclass"))
            idname=haorep(request.querystring("idname"))
            select case bigclass
            case "one"
            set rs=server.CreateObject("adodb.recordset")
            rs.open "select class1id,class1name from pclass1 " ,conn,1,1
            case "two"
            set rs=server.CreateObject("adodb.recordset")
            rs.open "select class2id,class2name from pclass2 where class1id=" & class1id & " " ,conn,1,1
            case "three"
            set rs=server.CreateObject("adodb.recordset")
            rs.open "select class3id,class3name from pclass3 where class2id=" & class2id & " " ,conn,1,1
            end select
            '開始寫入數據
            i=0
            do while not rs.eof
            i=i+1
            content=content & rs(1) & "$" & rs(0) & "-" '傳輸數據,以"-"分隔
            rs.movenext
            loop
            content=content & "," & idname '加入idname標志,以","分隔
            rs.close
            set rs=nothing
            conn.close
            set conn=nothing
            '寫入完畢,輸出內容
            response.write content
            response.end
            %>

            廣告:阿里云新人采購專場

            相關文章
            Ajax+asp實現三級聯動
            cms新聞系統購買咨詢
            掃描關注 廣州閱速軟件科技有限公司
            掃描關注 廣州閱速科技
            青娱乐极品视觉盛宴国产视频_精品人妻少妇一区二区_禁断の肉体乱爱中文字幕_国产日本卡二卡三卡四卡

            <font id="vh7td"></font>

                <rp id="vh7td"></rp>

                <address id="vh7td"></address>
                <em id="vh7td"><i id="vh7td"></i></em>

                    <mark id="vh7td"><noframes id="vh7td">
                    <font id="vh7td"></font>