0

假设此表单转到下一个并打开另一个弹出窗口。我也让它将表单数据传递给两个页面。

我遇到的问题是弹出窗口显示在除 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/

4

1 回答 1

0

编辑: Internet Explorer 阻止来自弹出窗口的 onchange 事件,您可以在用户单击按钮时执行该操作,这将允许弹出窗口通过阻止程序。

<input type="button" value="Change Country" onclick="myChangeHandler();return false;"/>
于 2012-11-01T19:55:20.653 回答