Home >Web Front-end >JS Tutorial >js mask effect to create pop-up registration interface effect
The example in this article shares the specific code of the js mask effect pop-up interface for your reference. The specific content is as follows
<head> <meta charset="UTF-8"> <title>遮罩</title> <style> * { margin: 0; padding: 0; } #shade{ position: fixed; width: 100%; height: 100%; display: none; } .shade-background{ width: 100%; height: 100%; background-color: #CCCCCC; opacity: 0.5; } #register{ position: relative; background-color: #fff; width: 500px; height: 300px; top: -70%; margin: 0 auto; } </style> </head> <body> <div id="shade"> <div class="shade-background"></div> <div id="register"> 用户名<input type="" name="" id="" value="" /><br /> 密 码<input type="" name="" id="" value="" /><br /> <input type="submit" name="" id="reg" value="注册" /> </div> </div> <div> <input type="button" name="" id="btn" value="弹出遮罩" /> </div> </body> <script> var shade = document.getElementById("shade"); var btn = document.getElementById("btn"); var reg = document.getElementById("reg"); btn.onclick = function(){ shade.style.display = "block" } reg.onclick = function(){ shade.style.display = "none" } </script>
Rendering:
The above is the entire content of this article. I hope it will be helpful to everyone's study. I also hope that everyone will support the PHP Chinese website.
For more js mask effect creation and pop-up registration interface effect related articles, please pay attention to the PHP Chinese website!