![](/img/trans.png)
[英]How to open the new tab using Playwright (ex. click the button to open the new section in a new tab)
[英]How to open an url in new tab using a button in vb.net which using command name not by the click event
我正在尝试使用按钮打开网址。 但是在这种情况下,我没有使用按钮单击事件,而是使用命令名将后面的URL代码正确化。 我可以转到url,但它在同一选项卡中发生,但我希望它在新选项卡中打开。 这是我正在使用的按钮
<asp:Button ID="btneditinformation" runat="server" CommandName="editinformation" CausesValidation="false" ToolTip="Edit information in QuickBase" Text="Edit Information" Height="30px" Width="100px" OnClientClick="aspnetForm.target ='_blank';"></asp:Button>
这是我试图使用的背后的代码
ElseIf e.CommandName = "editinformation" Then
Response.Redirect(url)
End If
提前致谢
服务器返回响应后,您将必须使用脚本管理器来帮助您执行javascript:
ScriptManager.RegisterStartupScript(Page, typeof(Page), "NewWindow", "window.open('" + url + "');", true);
有两种方法:
你可以通过jQuery做同样的事情
$("#btneditinformation").click(function () { window.open("URL","_blank") })
您可以使用锚标签,并为按钮提供适当的CSS类。
<a class="btn btn-success" target="_blank" href="#">Link</a>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.