多次提交一个表单到一个新的标签 [英] Submit a Form to a new Tab more than once
问题描述
< form method =postid = newsletter_formaction =>
< label for =subject>简报主题:< / label>< br />
< input type =textname =subjectclass =textField largeid =subject/>< br />< br />
< label for =contents>时事通讯内容:< / label>< br />
< / form>
然后有两个按钮,其中一个将动作设置为预览页面,并指向_blank,在新选项卡中打开,然后另一个按钮设置另一个操作,并移除目标,以便它正常提交并发送简报。但是,点击预览按钮只能在Chrome / Safari中使用一次。
我搜索了一下,发现这是Chrome和Safari中的一个错误。但是,我试图通过使用jQuery创建另一个表单,使用不同的ID,删除第一个表单,并使预览提交第二个表单来绕过此操作。这仍然不起作用。它适用于IE和Firefox,不在基于Webkit的浏览器中。
有什么方法可以解决这个问题?
这似乎适用于webkit。不知道它如何为IE工作。
$(#newsletter_form)。submit(function(){
$(#newsletter_form)。submit();
});
I am trying to build a simple form for sending a newsletter:
<form method="post" id="newsletter_form" action="">
<label for="subject">Newsletter Subject:</label><br/>
<input type="text" name="subject" class="textField large" id="subject" /><br/><br/>
<label for="contents">Newsletter Contents:</label><br/>
<textarea class="textField" rows="6" cols="40" name="contents" id="contents"></textarea>
</form>
And then two buttons, one of them sets the action to a preview page, and target to _blank, to open in a new tab, and then the other button sets another action, and removes the target, so that it submits normally and sends out the newsletter. However, hitting the preview button only works once in Chrome/Safari.
I have searched, and found out that this is a bug in Chrome and Safari. However, I am trying to bypass this by creating another form using jQuery, with a different ID, removing the first form, and making the preview submit that second form. This still doesn't work. It works for IE and Firefox, just not in Webkit based browsers.
Is there any way to get around this?
This seems to work for webkit. Not sure how it will work for IE.
$("#newsletter_form").submit(function(){
$("#newsletter_form").submit();
});
这篇关于多次提交一个表单到一个新的标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!