教程集 www.jiaochengji.com
教程集 >  脚本编程  >  Asp.net  >  正文 asp.net Response.Redirect跳出框架与打开窗口方法

asp.net Response.Redirect跳出框架与打开窗口方法

发布时间:2016-12-03   编辑:jiaochengji.com
教程集为您提供asp.net Response.Redirect跳出框架与打开窗口方法等资源,欢迎您收藏本站,我们将为您提供最新的asp.net Response.Redirect跳出框架与打开窗口方法资源

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    protected void Page_Load(object sender, EventArgs e)
    {
        Button1.Attributes.Add("onclick", "this.form.target='_newName'");
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("http://dotnet.aspx.cc");
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
</head>
<body id="b" runat="server">
<form id="form1" runat="server">
    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="打开新窗口或者新 Tab " />
</form>
</body>
</html>

如果需要设置弹出窗口的宽度和高度,可以修改为下面的方法:

<%@ Page Language="C#" AutoEventWireup="true" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    protected void Page_Load(object sender, EventArgs e)
    {
      string WindowName = "win" System.DateTime.Now.Ticks.ToString();
      Page.RegisterOnSubmitStatement("js", "window.open('','" WindowName "','width=600,height=200')");
        form1.Target = WindowName;
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("http://www.jiaochengji.com");
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
</head>
<body id="b" runat="server">
<form id="form1" runat="server">
    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="打开新窗口或者新 Tab " />
</form>
</body>
</html>

您可能感兴趣的文章:
asp.net Response.Redirect跳出框架与打开窗口方法
asp.net刷新页面的几种方法
JS的location.href跳出框架并打开新页面的方法
js自动刷新页面代码汇总
asp.net页面跳转的多种方法
js window.location、document.location、document.URL 对像的区别有哪些
NET MVC与WebForm的区别
解析jquery获取父窗口的元素
javascript内置对象之window对象
javascript编程基础(6)-Window窗口对象

[关闭]
~ ~