0
我在我的html页面中使用框架集,并且在框架集内有两个框架。第一帧有一个按钮,点击后会显示对话框。问题在于对话框仅在顶部框架中出现,而不是在全屏幕上。有没有什么办法可以隐藏框架点击按钮,并显示全屏幕弹出。在全屏幕显示对话框
root.html
<html
<frameset id="foo" rows="100,*" frameborder="0" framespacing="0">
<frame name="frame1" scrolling="no" src="frame1.html" >
<frame name="frame2" scrolling="yes" src="frame2.html">
</frameset>
</body>
</html>
frame1.html
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Dialog - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css">
<link rel="stylesheet" href="http:/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>
<script>
function showDialog()
{
var f = parent.document.getElementById('foo');
alert(f);
//parent.document.getElementsByTagName('frameset')[0].rows = "100%,0";
$("#dialog").dialog();
}
</script>
</head>
<body>
<p> Top Frame </p>
<button onclick="showDialog();">click Here </button>
<div id="dialog" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
</body>
</html>
frame2.html
<html>
<body>
Bottom Frame
</body>
</html>
我建议将您的监听器打开父级(root.html)页面内的对话框,然后让对话框本身在页面,也可以 - 因此您可以将其全屏显示到父级的“body”元素。您可以听取帧内的事件。看到这个问题在SO:http://stackoverflow.com/questions/12032074/triggering-an-event-handler-on-an-element-inside-iframe-from-parent-frame - 虽然它提及iframes,我' m确定这应该仍然是从frame1.html javascript,var f = document.getElementById('foo');'frameset'的框架' –
的情况。给予null而不是某个对象。任何想法我怎么能得到的对象 –