alert()和confirm()未显示在iframe的父级上

alert() and confirm() not showing on parent of iframe

本文关键字:iframe 显示 confirm alert      更新时间:2023-09-26

我有以下代码:

page1.php:

<html>...source...<iframe src="page2.php"/> ...more source...</html>

page2.php

<html><script> function myfunc(){window.confirm('....') ... more source}</script></html>

每当我处理page2时,它都会显示确认(警报)窗口,但每当从第1页打开它并显示在iframe中时,它就不会显示。我也试过window.parent.window.confirm/alert,但没有骰子,所以我想我错过了其他东西。因此,我的问题是:如何确保从iframed页面调用本地JS函数也会显示在父页面上?

该死的,我觉得自己很笨——甚至不能选择我的文本元素让我意识到我在iframe位于@-1中的一个div上有一个z索引,这使它无法选择。一旦解决了这个问题。感谢大家的评论和帮助!