【问题标题】:popUpWindow doesn't popup in the iframepopUpWindow 不会在 iframe 中弹出
【发布时间】:2012-01-10 11:12:00
【问题描述】:

--mainPage.php----

<div>
    <iframe>pageA.php</iframe>
</div>
<div>
    <iframe>pageB.php</iframe>

</div>

主页面包含两个 iframe,分别链接到 pageA.php 和 pageB.php。

在PageA.php 上,有一个链接可以点击显示popUpWindow.php。 (参见弹出窗口示例:http://www.javascript-coder.com/files/window-popup/javascript-window-open-example1.html)。

在我的情况下,popUpWindow.php 不会弹出,并且 pageA.php 在单击链接后被 popUpWindow.php 替换。以下是我的代码,有人可以帮助我吗?提前致谢!

--pageA.php-----

<script type="text/javascript">
        // Popup window code
        function newPopup(url) {
                popupWindow = window.open(
                        url,'popUpWindow','height=700,width=700,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')
        }
</script>

<a href="popUpWindow.php">Link</a>

【问题讨论】:

  • 你需要设置锚点目标。

标签: javascript html iframe


【解决方案1】:

你的 A 标签错误,应该调用你的 JavaScript 函数:

<a href="javascript:newPopup('popUpWindow.php');">Link</a>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-03-03
    • 1970-01-01
    • 2011-08-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多