佳木斯湛栽影视文化发展公司

主頁 > 知識(shí)庫 > Ajax級(jí)聯(lián)菜單實(shí)例代碼

Ajax級(jí)聯(lián)菜單實(shí)例代碼

熱門標(biāo)簽:Mysql連接數(shù)設(shè)置 科大訊飛語音識(shí)別系統(tǒng) 團(tuán)購網(wǎng)站 服務(wù)器配置 Linux服務(wù)器 阿里云 銀行業(yè)務(wù) 電子圍欄

1.Ajax.html

復(fù)制代碼 代碼如下:

!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>
    title>Ajax/title>
script type="text/javascript">
    function loadXMLDoc(txt) {
        var xmlhttp;
        if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp = new XMLHttpRequest();
        }
        else {// code for IE6, IE5
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange = function () {
            if (xmlhttp.readyState == 4 xmlhttp.status == 200) {
                var citys = xmlhttp.responseText.split(',');
                document.getElementById("citys").length = 1;
                for (i = 0; i citys.length - 1; i++) {

                    document.getElementById("citys").add(new Option(citys[i], citys[i]));
                }
                //                document.getElementById("myDiv").innerHTML = xmlhttp.responseText;
            }
        }
        xmlhttp.open("GET","ajax/getdata.aspx?pro="+txt, true);
        xmlhttp.send();
    }
/script>
/head>
body>

h2>AJAX/h2>
    select id="Select1" onchange="loadXMLDoc(this.value)">
        option>請選擇省份/option>
        option value="1">江蘇/option>
        option value="2">上海/option>
    /select>
       select id="citys">
        option>請選擇城市/option>
    /select>
div id="myDiv">/div>

/body>
/html>


2.getdata.aspx.cs
復(fù)制代碼 代碼如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class ajax_getdata : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string[] js=new string[]{"南京",  "蘇州",  "常州" , "無錫" ,  "鎮(zhèn)江"};
        string pro=Request.QueryString["pro"];
        if (pro == "1")
        {
            string temp = "";
            for (int i = 0; i js.Length; i++)
            {
                temp = temp + js[i];

                temp = temp + ",";

            }
            Response.Write(temp);
        }
        else
            Response.Write("");
    }
}

您可能感興趣的文章:
  • jQuery+ajax實(shí)現(xiàn)無刷新級(jí)聯(lián)菜單示例
  • 前臺(tái)JS(jquery ajax)調(diào)用后臺(tái)方法實(shí)現(xiàn)無刷新級(jí)聯(lián)菜單示例
  • AJAX 二級(jí)級(jí)聯(lián)菜單實(shí)現(xiàn)代碼
  • Ajax+Json 級(jí)聯(lián)菜單實(shí)現(xiàn)代碼
  • AJAX實(shí)現(xiàn)web頁面中級(jí)聯(lián)菜單的設(shè)計(jì)
  • ThinkPHP使用心得分享-ThinkPHP + Ajax 實(shí)現(xiàn)2級(jí)聯(lián)動(dòng)下拉菜單
  • 利用了jquery的ajax實(shí)現(xiàn)二級(jí)聯(lián)互動(dòng)菜單
  • ajax讀取數(shù)據(jù)庫內(nèi)容實(shí)現(xiàn)二級(jí)聯(lián)動(dòng)下拉選擇菜單示例
  • Javascript級(jí)聯(lián)下拉菜單以及AJAX數(shù)據(jù)驗(yàn)證核心代碼
  • 基于asp+ajax和數(shù)據(jù)庫驅(qū)動(dòng)的二級(jí)聯(lián)動(dòng)菜單
  • 一個(gè)強(qiáng)健 實(shí)用的asp+ajax二級(jí)聯(lián)動(dòng)菜單(有演示和附源程序打包下載)
  • ajax級(jí)聯(lián)菜單實(shí)現(xiàn)方法實(shí)例分析

標(biāo)簽:蚌埠 萍鄉(xiāng) 江蘇 棗莊 衢州 廣元 大理 衡水

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Ajax級(jí)聯(lián)菜單實(shí)例代碼》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    英德市| 潞西市| 高密市| 合作市| 南陵县| 庐江县| 揭东县| 江孜县| 新营市| 兴宁市| 井冈山市| 溧水县| 江城| 周宁县| 巴塘县| 吉木萨尔县| 阿瓦提县| 贡觉县| 封开县| 绥芬河市| 军事| 顺义区| 大厂| 托里县| 库尔勒市| 柘荣县| 吴川市| 乌拉特后旗| 连云港市| 东兰县| 仁寿县| 莱阳市| 霍林郭勒市| 炉霍县| 洪洞县| 文登市| 庆云县| 榆林市| 外汇| 三江| 随州市|