[英]Set a ASP.NET webform to submit to a new window via Javascript
Is there a way in Javascript to set a ASP.NET webform to submit to a new window? Javascript中是否可以设置ASP.NET Web表单以提交到新窗口? Simply put, when I click submit or press enter while in the form fields, I want the form to submit in a new window/tab.
简而言之,当我单击提交或在表单字段中按Enter时,我希望表单在新窗口/选项卡中提交。 I thought I could just do
jQuery('form').attr('target', '_blank');
我以为我可以做
jQuery('form').attr('target', '_blank');
but that is ignored, as if ASP.NET is taunting me. 但这被忽略,好像ASP.NET嘲笑我。
<form>
<button type="submit">one</button>
<button type="submit" class="popup">two</button>
</form>
$('.popup').click(function(e) {
e.preventDefault();
$(this).closest('form').attr('target', '_blank').submit()
});
I found the answer in this link:: 我在此链接中找到了答案::
setting target _blank for just one form submit action 仅针对一种表单提交操作设置目标_blank
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.