default.aspx

来自「AJAX入门20例之2」· ASPX 代码 · 共 61 行

ASPX
61
字号
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!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 runat="server">
    <title>无标题页</title>
    <script language="javascript">
       function Search()
       {
            var city=document.getElementById("TextBox1").value;
            if(city !="")
            {
               document.getElementById("iframe1").src="myframe.aspx?city=" +city;
            }
       }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        &nbsp;</div>
        <div style="width: 100px; height: 100px; vertical-align: middle; text-align: center;" >
        <table style="width: 549px">
            <tr>
                <td colspan="2" style="font-weight: bold; color: #0000cc">
                    Iframe实现局部刷新</td>
                <td>
                </td>
            </tr>
            <tr>
                <td>
                    城市名称:</td>
                <td>
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td>
                <td>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <input id="Button2" style="width: 153px" type="button" value="查询" onclick="Search()" /></td>
                <td>
                </td>
            </tr>
            <tr>
                <td style="height: 52px">
                    显示区域列表</td>
                <td style="height: 52px">
                <iframe src="myframe.aspx" style="TEXT-ALIGN: center" id="iframe1" width="100%" height="100%"  frameborder="0" scrolling="no"/>
                </td>
                <td style="height: 52px">
                </td>
            </tr>
        </table>
        </div>
    </form>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?