欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

幾個不同類型無刷新聯(lián)動例子

Iframe實現(xiàn)無刷新聯(lián)動

iframe的無刷新其實是局部刷新,狀態(tài)欄的滾動條還是會滾動,只是頁面不會閃爍,這是一種比較老的技術(shù)了,在處理的數(shù)據(jù)兩大的時候會比較慢,在本例中需要兩個頁面:oec2003index.aspx和oec2003frame.asapx,oec2003index.aspx用來顯示界面,其中有一個iframe標(biāo)記,指向oec2003frame.aspx頁用來顯示結(jié)果

網(wǎng)站建設(shè)哪家好,找成都創(chuàng)新互聯(lián)!專注于網(wǎng)頁設(shè)計、網(wǎng)站建設(shè)、微信開發(fā)、微信小程序開發(fā)、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了點軍免費建站歡迎大家使用!

oec2003index.aspx前臺代碼

<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="oec2003Index.aspx.cs"Inherits="_Default"%>
<!DOCTYPEhtml PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headid="Head1"runat="server">
    <title>無標(biāo)題頁</title>

    <scripttype="text/javascript">
        functionQuery() {
            varddlpro = document.getElementById('ddlPro');
            varpro = ddlpro.options[ddlpro.selectedIndex].innerText;
            if(pro != "") {
                document.getElementById("iframe1").src = "oec2003frame.aspx?Pro="+ pro;
            }
        }

    </script>

</head>
<body>
    <formid="form2"runat="server">
    <div>
        <tableborder="1"cellpadding="3"cellspacing="0"width="600px">
            <tr>
                <tdcolspan="2"align="center">
           Iframe實現(xiàn)局部刷新
                </td>
            </tr>
            <tr>
                <td>
           省份名稱:
                </td>
                <td>
                    <selectid="ddlPro"style="width: 201px">
                        <optionvalue="湖北">湖北</option>
                        <optionvalue="河北">河北</option>
                        <optionvalue="廣東">廣東</option>
                        <optionvalue="河南">河南</option>
                    </select>
                    <inputid="Button1"type="button"value="查詢"onclick="Query()" />
                </td>
            </tr>
            <tr>
                <td>
           顯示城市列表
                </td>
                <td>
                    <iframesrc="oec2003frame.aspx"style="text-align: center"id="iframe1"width="100%"
               height="100%"frameborder="0"scrolling="no" />
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>

oec2003frame.aspx的前臺代碼:

<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="oec2003frame.aspx.cs"Inherits="myframe"%>
<!DOCTYPEhtml PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headid="Head1"runat="server">
    <title>無標(biāo)題頁</title>
</head>
<body>
    <formid="form2"runat="server">
    <div>
        <asp:DropDownListID="ddlCity"runat="server"Width="179px">
        </asp:DropDownList>
    </div>
    </form>
</body>
</html>

oec2003frame.aspx后臺代碼:

usingSystem;
usingSystem.Data;
usingSystem.Configuration;
usingSystem.Collections;
usingSystem.Web;
usingSystem.Web.Security;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Web.UI.WebControls.WebParts;
usingSystem.Web.UI.HtmlControls;

public partial classmyframe: System.Web.UI.Page{
    protected voidPage_Load(objectsender, EventArgse)
    {
        stringpro = Request.QueryString["pro"];
        switch(pro)
        {
            case"湖北":
                this.ddlCity.Items.Clear();
                this.ddlCity.Items.Add("武漢");
                this.ddlCity.Items.Add("黃岡");
                this.ddlCity.Items.Add("黃石");
                this.ddlCity.Items.Add("襄樊");
                break;
            case"河北":
                this.ddlCity.Items.Clear();
                this.ddlCity.Items.Add("石家莊");
                this.ddlCity.Items.Add("唐山");
                this.ddlCity.Items.Add("承德");
                this.ddlCity.Items.Add("邯鄲");
                break;
            case"廣東":
                this.ddlCity.Items.Clear();
                this.ddlCity.Items.Add("廣州");
                this.ddlCity.Items.Add("佛山");
                this.ddlCity.Items.Add("深圳");
                this.ddlCity.Items.Add("珠海");
                break;
            case"河南":
                this.ddlCity.Items.Clear();
                this.ddlCity.Items.Add("鄭州");
                this.ddlCity.Items.Add("新鄉(xiāng)");
                this.ddlCity.Items.Add("安陽");
                this.ddlCity.Items.Add("信陽");
                break;

        }
    }
}

Javascript無刷新聯(lián)動

前臺頁面代碼:

<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="oec2003index.aspx.cs"
Inherits="jacascript_Default"%>
<!DOCTYPEhtml PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headid="Head1"runat="server">
    <title>無標(biāo)題頁</title>

    <scripttype="text/javascript">
        functionFillData(strcity) {

            document.getElementById("ddlCity").options.length = 0;
            varindexofcity;
            varcity;
            while(strcity.length > 0) {
                indexofcity = strcity.indexOf(",");
                if(indexofcity > 0) {
                    city = strcity.substring(0, indexofcity);

                    strcity = strcity.substring(indexofcity + 1);
                    document.getElementById("ddlCity").add(newOption(city, city));
                }
                else{
                    document.getElementById("ddlCity").add(newOption(strcity, strcity));
                    break;
                }

            }
        }
    </script>

</head>
<body>
    <formid="form2"runat="server">
    <div>
        <tablewidth="700px"border="1"cellpadding="5"cellspacing="0">
            <tr>
                <tdcolspan="2"align="center">
           腳本方法實現(xiàn)刷新
                </td>
            </tr>
            <tr>
                <td>
           選擇省份:
                </td>
                <td>
                    <selectid="ddlPro"style="width: 201px">
                        <optionvalue="湖北">湖北</option>
                        <optionvalue="河北">河北</option>
                        <optionvalue="廣東">廣東</option>
                        <optionvalue="河南">河南</option>
                    </select>
                    <inputid="btnQuery"type="button"value=" 查詢"onclick="City()" />
                </td>
            </tr>
            <tr>
                <td>
           城市:
                </td>
                <td>
                    <asp:DropDownListID="ddlCity"runat="server"Width="201px">
                    </asp:DropDownList>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>

后臺代碼:

usingSystem;
usingSystem.Data;
usingSystem.Configuration;
usingSystem.Collections;
usingSystem.Web;
usingSystem.Web.Security;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Web.UI.WebControls.WebParts;
usingSystem.Web.UI.HtmlControls;
usingSystem.Text;

public partial classjacascript_Default: System.Web.UI.Page{
    protected voidPage_Load(objectsender, EventArgse)
    {
        StringBuildermyscript = newStringBuilder();
        myscript.Append("function City() {\n");
        myscript.Append("var ddlpro=document.getElementById('ddlPro');\n");
        myscript.Append("var pro=ddlpro.options[ddlpro.selectedIndex].innerText;\n");
        //myscript.Append("var pro=document.getElementById('txtPro').value;\n");
myscript.Append("switch(pro) { \n");
        myscript.Append("case '湖北':\n");
        myscript.Append("FillData('"+ GetCityStr("湖北") + "');\n");
        myscript.Append("break;\n");
        myscript.Append("case '河北':\n");
        myscript.Append("FillData('"+ GetCityStr("河北") + "');\n");
        myscript.Append("break;\n");
        myscript.Append("case '廣東':\n");
        myscript.Append("FillData('"+ GetCityStr("廣東") + "');\n");
        myscript.Append("break;\n");
        myscript.Append("case '河南':\n");
        myscript.Append("FillData('"+ GetCityStr("河南") + "');\n");
        myscript.Append("break;}\n");
        myscript.Append("}\n");

        Page.ClientScript.RegisterClientScriptBlock(typeof(string), "city", myscript.ToString(), true);

    }

    private stringGetCityStr(stringpro)
    {
        stringcity = "";
        switch(pro)
        {
            case"湖北":
                city = "武漢,黃岡,黃石,襄樊";
                break;
            case"河北":
                city = "石家莊,唐山,承德,邯鄲";
                break;
            case"廣東":
                city = "廣州,佛山,深圳,珠海";
                break;
            case"河南":
                city = "鄭州,新鄉(xiāng),安陽,信陽";
                break;
        }
        returncity;
    }
}

CallBack無刷新聯(lián)動

前臺代碼:

<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="oec2003index.aspx.cs"Inherits="callback_Default"%>
<!DOCTYPEhtml PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headid="Head1"runat="server">
    <title>無標(biāo)題頁</title>

    <scripttype="text/javascript">
         functionFillData()
         {
             varddlpro=document.getElementById('ddlPro');
             varpro=ddlpro.options[ddlpro.selectedIndex].value;
             <% =ClientScript.GetCallbackEventReference(this,"pro","FillDll",null) %>
         } 

        functionFillDll(strcity)
        {
            document.getElementById("ddlCity").options.length=0;
            varindexofcity;
            varcity;
            while(strcity.length>0)
            {
                indexofcity=strcity.indexOf(",");
                if(indexofcity>0)
                {
                    city=strcity.substring(0,indexofcity);
                    strcity=strcity.substring(indexofcity+1);
                    document.getElementById("ddlCity").add(newOption(city,city));
                }
                else
       {
                    document.getElementById("ddlCity").add(newOption(strcity,strcity));
                    break;
                }
            }
        }
    </script>

</head>
<body>
    <formid="form2"runat="server">
    <div>
        <tablewidth="700px"border="1"cellpadding="5"cellspacing="0">
            <tr>
                <tdcolspan="2"align="center">
           callback方法實現(xiàn)刷新
                </td>
            </tr>
            <tr>
                <td>
           選擇省份:
                </td>
                <td>
                    <selectid="ddlPro"style="width: 200px">
                        <optionvalue="湖北">湖北</option>
                        <optionvalue="河北">河北</option>
                        <optionvalue="廣東">廣東</option>
                        <optionvalue="河南">河南</option>
                    </select>
                    <inputid="btnQuery"type="button"value=" 查詢"onclick="FillData()" />
                </td>
            </tr>
            <tr>
                <td>
           城市:
                </td>
                <td>
                    <asp:DropDownListID="ddlCity"runat="server"Width="201px">
                    </asp:DropDownList>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>

后臺代碼:

usingSystem;
usingSystem.Data;
usingSystem.Configuration;
usingSystem.Collections;
usingSystem.Web;
usingSystem.Web.Security;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Web.UI.WebControls.WebParts;
usingSystem.Web.UI.HtmlControls; 

public partial classcallback_Default: System.Web.UI.Page,ICallbackEventHandler{
 private string_data;
 protected voidPage_Load(objectsender, EventArgse)
 { 

 } 

 //ICallbackEventHandler 成員}

Ajax無刷新聯(lián)動

該例子也要用到兩個頁面:oec203index.aspx和oec2003datapage.aspx. oec2003datapage.aspx主要用來回送要顯示的數(shù)據(jù)

oec2003.aspx頁面前臺代碼:

<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="oec2003index.aspx.cs"Inherits="ajax_Default"%>
<!DOCTYPEhtml PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headid="Head1"runat="server">
    <title>無標(biāo)題頁</title>

    <scripttype="text/javascript">
        varxmlhttp;
        functiongetData() {
            varddlpro = document.getElementById("ddlPro");
            varpro = ddlpro.options[ddlpro.selectedIndex].innerText;
            xmlhttp = newActiveXObject("Microsoft.XMLHTTP");
            xmlhttp.onreadystatechange = statechange;
            xmlhttp.Open("GET", "oec2003datapage.aspx?pro="+ pro, true);
            xmlhttp.Send();
        }

        functionstatechange() {
            if(xmlhttp.readystate == 4) {
                if(xmlhttp.status == 200) {
                    FillData(xmlhttp.responseText);
                }
            }
        }
        functionFillData(strcity) {
            document.getElementById("ddlCity").options.length = 0;
            varindexofcity;
            varcity;
            while(strcity.length > 0) {
                indexofcity = strcity.indexOf(",");
                if(indexofcity > 0) {
                    city = strcity.substring(0, indexofcity);
                    strcity = strcity.substring(indexofcity + 1);
                    document.getElementById("ddlCity").add(newOption(city, city));
                }
                else{
                    document.getElementById("ddlCity").add(newOption(strcity, strcity));
                    break;
                }
            }
        }
    </script>

</head>
<body>
    <formid="form1"runat="server">
    <div>
        <tablewidth="700px"border="1"cellpadding="5"cellspacing="0">
            <tr>
                <tdcolspan="2"align="center">
           ajax方法實現(xiàn)刷新
                </td>
            </tr>
            <tr>
                <td>
           選擇省份:
                </td>
                <td>
                    <selectid="ddlPro"style="width: 201px">
                        <optionvalue="湖北">湖北</option>
                        <optionvalue="河北">河北</option>
                        <optionvalue="廣東">廣東</option>
                        <optionvalue="河南">河南</option>
                    </select>
                    <inputid="btnQuery"type="button"value=" 查詢"onclick="getData()" />
                </td>
            </tr>
            <tr>
                <td>
           城市:
                </td>
                <td>
                    <asp:DropDownListID="ddlCity"runat="server"Width="201px">
                    </asp:DropDownList>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>

oec2003datapage.aspx后臺代碼:

usingSystem;
usingSystem.Data;
usingSystem.Configuration;
usingSystem.Collections;
usingSystem.Web;
usingSystem.Web.Security;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Web.UI.WebControls.WebParts;
usingSystem.Web.UI.HtmlControls;

public partial classajax_datapage: System.Web.UI.Page{
    protected voidPage_Load(objectsender, EventArgse)
    {
        stringpro = Request.QueryString["pro"];
        Response.Clear();
        switch(pro)
        {
            case"湖北":
                Response.Write("武漢,黃岡,黃石,襄樊");
                break;
            case"河北":
                Response.Write("石家莊,唐山,承德,邯鄲");
                break;
            case"廣東":
                Response.Write("廣州,佛山,深圳,珠海");
                break;
            case"河南":
                Response.Write("鄭州,新鄉(xiāng),安陽,信陽");
                break;
        }
    }
}

當(dāng)前題目:幾個不同類型無刷新聯(lián)動例子
標(biāo)題鏈接:http://chinadenli.net/article40/gpdieo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供App開發(fā)、標(biāo)簽優(yōu)化、Google、品牌網(wǎng)站設(shè)計、手機(jī)網(wǎng)站建設(shè)、企業(yè)建站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都做網(wǎng)站