Question: In index.html, iframe introduces son.html. How can I click on a certain operation in son.html to block the entire page and pop up the layer to be displayed? Prepare: index.html son.html Ideas: 1: Introduce son.html into iframe in index.html, Copy code The code is as follows:<!-- Right iframe starts--> <div id="resDiv" class="resDiv"> <iframe name="res" class="iframestyle" allowtransparency="true" src="son.html" frameborder="0" scrolling="no"></iframe> </div> <!-- End of right iframe --> 2: Add a shielding layer and a content display layer to the body of index.html Copy code The code is as follows:<!--Pop-up login page layer--> <div id="mapLayer" style="display: none; " > <input type="button" value="Close" onclick="closeMap()" /> </div> <!--Shielding layer, used to transparently shield the entire page--> <div id="mapBgLayer" style="position:absolute; display: none;"></div> 3: How to set the div style and open and close the layer in index.html Copy code The code is as follows:<style type="text/css"> #BgLayer { background: #939393 none repeat scroll 0 0; height:100%; width:100%; left:0; top:0; filter: alpha(opacity=80); /* IE */ -moz-opacity: 0.8; /* Moz + FF */ z-index: 10000; } #Layer { width: 400px; height: 400px; margin: -180px 0 0 -170px; left: 50%; top: 50%; position: absolute; background: #FFF; z-index: 10001; border: 1px solid #1B5BAC; } </style> <script type="text/javascript"> /*Display page*/ function showDiv) { var bg = document.getElementById("BgLayer"); var con = document.getElementById("Layer"); //var w = document.documentElement.clientWidth; //Width of visible area of web page //var h = document.documentElement.clientHeight; //Height of visible area of web page var w = document.body.scrollWidth; //Full text width of the webpage var h = document.body.scrollHeight; //Height of the full text of the web page // alert(w+"-"+h); bg.style.display = ""; bg.style.width = w + "px"; bg.style.height = h + "px"; con.style.display = ""; } /*closure*/ function closeDiv() { var bg = document.getElementById("BgLayer"); var con = document.getElementById("Layer"); bg.style.display = "none"; con.style.display = "none"; } </script> 4: An operation in son.html calls a method on the parent page Copy code The code is as follows:<a href="javascript:void(0)" onclick="parent.window.showDiv()">View</a> |
<<: Creative opening effect achieved by combining CSS 3.0 with video
>>: MySQL 8.0.26 installation and simplified tutorial (the most complete on the Internet)
In the previous article, we talked about MySQL tr...
Generate a certificate chain Use the script to ge...
Table of contents 1. Instructions 2. Modifiers 3....
Table of contents Introduction to Anaconda 1. Dow...
Perfect solution to VMware black screen after Mac...
Table of contents Prototype chain diagram Essenti...
1. Text formatting: This example demonstrates how...
Starting from MySQL 8.0.16, you can set a passwor...
In the previous article [Detailed explanation of ...
Preface add_header is a directive defined in the ...
Method 1: Use the SET PASSWORD command First log ...
Table of contents 1. Introduction 2. Understand t...
Table of contents Interpolation Expressions metho...
Table of contents How to deploy MySQL service usi...
Table of contents 1. Anti-shake function 2. Use d...