如何在新标签页/窗口中打开ASP页面?

时间:2021-02-03 21:17:03

I know that the HTML anchor tag has an attribute called target, which will open a new page in a new window/tab if we set target='_blank'. It should work well with static HTML pages.

我知道HTML锚标签有一个名为target的属性,如果我们设置target ='_ blank',它将在新窗口/选项卡中打开一个新页面。它应该适用于静态HTML页面。

However, when we submitting a form by clicking the submit button on an ASP page, I find that the result page normally will be loaded into the same tab/window.

但是,当我们通过单击ASP页面上的提交按钮提交表单时,我发现结果页面通常会被加载到同一个选项卡/窗口中。

So my question is: are we able to load page into a new tab/window when user clicks submit button?

所以我的问题是:当用户点击提交按钮时,我们能够将页面加载到新的选项卡/窗口吗?

Thanks.

EDIT: Looks like <form target='blank'> is the answer although its said to be deprecated according to w3schools website. :)

编辑:看起来像

是答案虽然根据w3schools网站说它已被弃用。 :)

4 个解决方案

#1


4  

Just like a link:

就像一个链接:

<form target='_blank'>

No need to do anything on the ASP side of things. Of course, as with all pop-ups, this is subject to browser settings.

无需在ASP方面做任何事情。当然,与所有弹出窗口一样,这取决于浏览器设置。

#2


4  

Form's target shold work.

表格的目标是工作。

<form target="_blank" ...></form>

From here (have you searched?)

从这里(你搜索过吗?)

#3


1  

Try this out..

试试这个......

Response.Redirect to new window

Response.Redirect to new window

#4


0  

You have two methods for redirecting the page to new tab in asp

您有两种方法可以将页面重定向到asp中的新选项卡

1) Make an onclientclick event of Button and on code behind of Button Click write the following code:-

1)创建一个onclientclick事件的Button和on Button后面的代码点击下面的代码: -

button.OnClientClick = "aspnetForm.target='_blank'"; Response.Redirect("yourpage.aspx");

2)You can also use javascript

2)你也可以使用javascript

 button.Attributes.Add("onclick", "window.open('yourpage.aspx');return false;");

Both the method will redirect your page to new tab on clicking the button.

在单击按钮时,该方法都会将页面重定向到新选项卡。

#1


4  

Just like a link:

就像一个链接:

<form target='_blank'>

No need to do anything on the ASP side of things. Of course, as with all pop-ups, this is subject to browser settings.

无需在ASP方面做任何事情。当然,与所有弹出窗口一样,这取决于浏览器设置。

#2


4  

Form's target shold work.

表格的目标是工作。

<form target="_blank" ...></form>

From here (have you searched?)

从这里(你搜索过吗?)

#3


1  

Try this out..

试试这个......

Response.Redirect to new window

Response.Redirect to new window

#4


0  

You have two methods for redirecting the page to new tab in asp

您有两种方法可以将页面重定向到asp中的新选项卡

1) Make an onclientclick event of Button and on code behind of Button Click write the following code:-

1)创建一个onclientclick事件的Button和on Button后面的代码点击下面的代码: -

button.OnClientClick = "aspnetForm.target='_blank'"; Response.Redirect("yourpage.aspx");

2)You can also use javascript

2)你也可以使用javascript

 button.Attributes.Add("onclick", "window.open('yourpage.aspx');return false;");

Both the method will redirect your page to new tab on clicking the button.

在单击按钮时,该方法都会将页面重定向到新选项卡。