标签:
项目中碰到需要跨框架显示div的问题,百度了一下,搜集了一下群众的智慧,特整理出下面这个例子,先看看效果图:
本例共有4个页面:
index.html
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style> .popDiv{ position:absolute; float:left; width:300px; height:300px; background-color:#f7f7f7; top:50; left:25; display:none; z-index:2; } </style> </head> <body> <div id='popId' class='popDiv'>the test div float over iframe.</div> <iframe src="frame.html" width=100% height=100% marginwidth=0></iframe> </body> </html>
frame.html
<frameset rows="74,*" cols="*" style="z-index:1"> <frame src="frame-top.html" style="z-index:1"> <frame src="frame-main.html" style="z-index:1"> </frameset> <noframes></noframes>
frame-top.html
<a href="#" onclick="top.document.getElementById('popId').style.display='block'">show div</a>
frame-main.html
I'm main frame
标签:
原文地址:http://blog.csdn.net/xhbmj/article/details/42105857