編寫HTML程式碼時候用Iframe中彈出層覆蓋整個頁面,程式碼如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd">
<button onclick="javascript:parent.popit();">彈出</button><br><br>
編寫HTML程式碼時候用Iframe中彈出層覆蓋整個頁面,程式碼如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd">
<HTML><head><script>var cover =mydiv= null;window.onload = function() { cover=document.getElementById("coverdiv"); cover.style.width = Math.max(document.documentElement.scrollWidth, document.documentElement.clientWidth)+ "px"; cover.style.height = Math.max(document.documentElement.scrollHeight, document.documentElement.clientHeight) + "px" cover.style.display = "none"; mydiv = document.getElementById("mydiv"); with (mydiv){ style.width = document.documentElement.scrollHeight/2+"px"; style.height = document.documentElement.scrollHeight/2+"px"; style.left = (document.documentElement.scrollWidth - mydiv.offsetWidth)/2+"px"; style.top = (document.documentElement.scrollHeight - mydiv.offsetHeight)/2+"px"; style.display = "none"; }};function popit(){ mydiv.style.display=cover.style.display = "";}</script></head><BODY><div> </div><div>我的層 <br><input value="關閉" type="button" onclick="javacript:mydiv.style.display =cover.style.display = "none";" /></div><iframe id=aaa src="222.htm"></iframe></BODY> </HTML><button onclick="javascript:parent.popit();">彈出</button><br><br>