网站是这样的:
`--main.html
`--dialog.html
`--folder
`--iframe.html
代码在这里:
main.html:
<html>
<head>
<script type="text/javascript">
function testframe() {
var doc = document.getElementById("frame").contentWindow;
doc.show();
}
</script>
</head>
<body>
<iframe src="folder/iframe.html" id="frame"></iframe>
<br/>
<button onclick="testframe()">test</button>
</body>
</html>
对话框.html:
<html>
<head>
</head>
<body>
This is modal dialog!
</body>
</html>
iframe.html:
<html>
<head>
<script type="text/javascript">
function show() {
showModalDialog('../dialog.html');
}
</script>
</head>
<body>
this is ifram
<br />
<button onclick="show()">show dialog</button>
</body>
</html>
当我单击 iframe 中的显示对话框按钮时,它会正确显示模态对话框。
当我单击 iram 外部的测试按钮时,它会错误地显示模态对话框。
当我单击 iram 外部的测试按钮以在 dilog 中显示正确的页面时,如何解决此问题?