问题描述
希望你能在这里帮忙...
我有一个表单翻译字段中的单词,用翻译的术语填充字段,然后在一个提交按钮中提交操作。
Hope you can help a bit here...I have a form that translate a word in a field, populate the field with the translated term and then do submit action all in one submit button.
提交由jquery提出。
问题是目标页面被阻止,因为所有3个主要浏览器都将其视为弹出窗口,
您是否知道如何将其作为新选项卡或新窗口打开?
我不想将目标设置为_self,因为我希望人们也可以打开我的网站。
the submit is being made by jquery.problem is the target page is being blocked as all 3 major browsers treat it as popup,Do you know how to let it open just as a new tab or new window ?I don't want to set the target as _self as I want people to have my site open as well.
我认为问题出现在这个字符串中:
I believe the problem is in this string:
document.forms.form1.submit();
但我也知道应该有一种方法来重新定义它,所以目标不会被视为一个弹出窗口。
but I also know there should be a way to rephrase it so the target won't be treated as a popup.
这是脚本:
<script type="text/javascript">
$(function transle() {
$('#transbox').sundayMorningReset();
$('#transbox input[type=button]').click(function(evt) {
$.sundayMorning(
$('#transbox input[type=text]').val(), {
source: '',
destination: 'ZH',
menuLeft: evt.pageX,
menuTop: evt.pageY
},
function(response) {
$('#transbox input[type=text]').val(response.translation);
//document.getElementById("form1").submit();
document.forms.form1.submit();
}
);
});
});
</script>
这是表格:
<table id="transbox" name="transbox" width="30px" border="0" cellspacing="0" cellpadding="0">
<form action="custom-page" method="get" name="form1" target="_blank" id="form1">
<tr>
<td>
<input id="q" name="q" type="text" class="search_input" onFocus="if (this.value == 'Evening dress') {this.value = '';}" onBlur="if (this.value == '') {this.value = 'Evening dress';}" value="Evening dress" />
</td>
<td>
<input type="button" value="Find" style="color: #333; width: 157px; font-weight:bold"></input>
</td>
</tr>
</form>
</table>
编辑
我已尝试提交所有这些字符串:
I have tried all of these strings to submit:
document.getElementById("form1").submit();
document.forms.form1.submit();
form1.submit();
所有目标都被弹出窗口阻止。
拜托,有没有其他方法我应该做代码不让它弹出?
all ends up with the target being popup blocked.please, is there any other way I should do the code to not let it popup ?
也许应该使用onsubmit来制作jQuery?
有人知道怎么做?
maybe should use the onsubmit to make jQuery ?someone knows how ?
推荐答案
浏览器只会在没有弹出窗口阻止程序警告的情况下打开标签/弹出窗口打开选项卡/弹出窗口来自
这篇关于在新窗口中打开页面,没有弹出窗口阻止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!