JS弹窗代码,可自己设计样式,很简单方便!


<html> 
<head> 
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"/>
<meta charset="utf-8" />
  <title>LIGHTBOX EXAMPLE</title> 

   <script>
   function on(){
    document.getElementById('light').style.display='block';
    document.getElementById('fade').style.display='block'
   }
   function off(){
    document.getElementById('light').style.display='none';
    document.getElementById('fade').style.display='none'
   }
   </script>
</head> 
<body> 

  <p>
    <a href="javascript:void(0)" onclick="on()">点击这里打开窗口</a>
  </p> 
  <div id="light" style="display: none; position: absolute; top: 25%; left: 25%; width: 50%; height: 50%; padding: 16px; border: 16px solid orange; background-color: white; z-index:1002; overflow: auto;"> 
  
    This is the lightbox content. 
    <a href="javascript:void(0)" onclick="off()">Close</a>
  </div> 
  <div id="fade" style="display: none; position: absolute; top: 0%; left: 0%; width: 100%; height: 100%; background-color: black; z-index:1001; -moz-opacity: 0.6; opacity:.60; filter: alpha(opacity=60);"> 
  
  </div> 
</body> 
</html>

本文链接:https://www.dnwfb.com/1534.html,转载请注明出处。
0

评论0

没有账号? 注册  忘记密码?