use*_*285 4 forms jquery redirect google-chrome onclick
我试图(1)将表单提交到外部网站,该网站应该在新标签中启动,同时(2)将带有表单的浏览器窗口重定向到感谢页面.
我的代码适用于Firefox和Internet Explorer,如果删除其他部分,我将在Chrome/Safari中执行part(1)或part(2).
<script>
function testfunc() {
alert('Submit Clicked');
jQuery('form#getaQuote').submit();
alert('Form submit attempted');
window.location.href = ('http://ct.athiel.ca');
alert('Redirect attempted');
}
</script>
<form id="getaQuote" action="http://www.winquote.net/complete.pl" target="_blank">
<input type="text" name="field1" />
<input type="button" value="Submit" onclick="testfunc()" />
</form>
Run Code Online (Sandbox Code Playgroud)
你可以在这里尝试代码---> http://jsfiddle.net/GjyMd/7/
任何帮助将不胜感激,这个问题已经过去了.
这有效:jsFiddle
JavaScript的:
function testfunc() {
alert('Submit Clicked');
setTimeout(function() {
window.location.href = ('http://ct.athiel.ca');
alert('Redirect attempted');
}, 1);
jQuery('form#getaQuote').submit();
alert('Form submit attempted');
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3202 次 |
| 最近记录: |