frameset应用例子——利用javascript跳转

来源:互联网 发布:mysql数据库分页 编辑:程序博客网 时间:2024/06/03 13:51
 

index

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<frameset cols="10%,*">
<frame src="1.aspx" noresize="noresize" name="frame1" frameborder="0" />
<frame src="2.aspx" noresize="noresize" name="frame2" frameborder="0" />
</frameset>
</html>

 

1.aspx

<body>
    <form id="form1" runat="server" target="frame2">
    <div>
        <asp:TextBox ID="TextBox1" runat="server">http://www.baidu.com</asp:TextBox><br />
        <br /><br />
        <asp:Button ID="Button1" runat="server" Text="转向网址" onclick="Button1_Click" />
    </div>
    </form>
</body>

 

1.cs

    public partial class _1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Response.Redirect(this.TextBox1.Text);
        }
    }

 

2.aspx

<body>
    <form id="form1" runat="server">
    <div>
   
    </div>
    </form>
</body>

 

当点击按钮时,1.aspx中文本框的网址,将在2.aspx中显示!

原创粉丝点击