一个很简单的弹窗
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title> <script src="jquery-1.7.1.js"></script> <style type="text/css"> #divpanel { background-color: white; display: none; position: absolute; left: 380px; top: 200px; width: 500px; height: 300px; } #bg { background-color: #808080; opacity: 0.6; display: none; position: absolute; left: 0px; top: 0px; height: 100%; width: 100%; } </style> <script type="text/javascript"> $(function () { $("#btn1").click(function () { $("#divpanel,#bg").show(); }); $("#closewin").click(function () { $("#divpanel,#bg").hide(); }); }) </script> </head> <body> <input type="button" name="name" value="弹窗 " id="btn1" /> <div id="bg"></div> <div id="divpanel"> <div id="closewin" style="float: right; cursor: pointer">关闭</div> </div> </body> </html>
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】凌霞软件回馈社区,携手博客园推出1Panel与Halo联合会员
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步