假设此表单转到下一个并打开另一个弹出窗口。我也让它将表单数据传递给两个页面。
我遇到的问题是弹出窗口显示在除 IE 之外的所有浏览器中。它一直被 IE 中的弹出窗口阻止程序阻止。我需要弹出窗口显示而不会被阻止。
<script language="javascript">
function myChangeHandler() {
var form = document.getElementById('TheForm');
form.method = 'POST';
form.action = 'https://test.com/page1';
form.target = 'window_1';
window.open('', 'window_1','fullscreen=1,scrollbars=1');
this.form.submit();
var state_ac = document.getElementById('stateDrop');
var state_dd = state_ac.options[state_ac.selectedIndex].value;
window.location = 'https://test.com/page2';
}
</script>
<form id="TheForm" action="https://test.com/page2" method="post">
<select id="stateDrop" name="state" size="1" onchange="myChangeHandler.apply(this)">
<option value="null" selected="selected" style="color:#b3b3b3">- Select Your State -</option>
<option value="AL" class="others">Alabama</option>
<option value="AK" class="others">Alaska</option>
<option value="AZ" class="others">Arizona</option>
</select>
<input id="featured-image-right-button" type="image" src="<?php bloginfo('template_url'); ?>/images/featured-image-right-button.png" alt="" disabled="disabled" />
</form>
EDIT: see the example here, the popup works in every other browser when the option is selected but the pop up is blocked in ie. 单击按钮时它在 IE 中工作正常,但选择该选项时弹出窗口被阻止http://jsfiddle.net/uyeq3/