制作弹窗遮罩效果

<!DOCTYPE html>
<html>
  <head>
    <title>domo.html</title>
	
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
   	<script type="text/javascript" src="/play/js/jquery-1.8.2.js"></script>
   <script>
   	$(function(){
		
			alertMsg('传入你要显示的信息')
	function alertMsg(msg){
		var mask_div='<div class="mask_div" style="margin:0px;padding:0px;background:#94A8A9;align:center;' +
	  			'opacity:0.7;z-index:1000;position:absolute;top:0px;"></div>';
	  	var msgWin='<div class="msgWin" style="position:absolute;z-index:1001;' +
	  			'width:400px;height:200px;overflow:hidden;' +
	  			'margin-left:40%;top:100px;border:1px solid #22ADE8;"/>';
	  	var msg_title='<div style="height:30px;line-height:30px;' +
	  			'background:#22ADE8;cursor:pointer;' +
	  			'font-size:12px;color:white;text-align:right;" class="msg_title">关闭 </div>';
	  	var msg_content='<div style="background:white;' +
	  			'text-align:center;font-size:12px;height:70px;padding:30px;" class="msg_content"></div>'
	  	
	  	var button='<div style="background:#ECECEC;margin:0px;padding:0px;height:35px;text-align:center;padding-top:8px">' +
	  			'<button class="msg_confirm" style="margin-right:10px;background:#22ADE8;cursor:pointer;">确定</button><button class="msg_cancel"' +
	  			'style="margin-right:10px;background:#ECECEC;cursor:pointer;">取消</button></div>';
	  	var bodyWidth=window.screen.availWidth;  //屏幕宽
		var bodyHeight=window.screen.availHeight;//屏幕高
	  //var bodyWidth=document.body.clientWidth;//可见宽
	  //var bodyHeight=document.body.clientHeight;//可见高
	  	$('body').append(mask_div)
	  	$('.mask_div').width(bodyWidth)
	  	$('.mask_div').height(bodyHeight)
	  	$('body').append(msgWin)
	  	$('.msgWin').append(msg_title)
	  	$('.msgWin').append(msg_content)
	  	$('.msgWin').append(button)
	  	$('.msg_content').html(msg)
	  	
	  	
	  	$(".msg_title").click(function(){
	  	     $('.mask_div').remove()
	  	     $('.msgWin').remove()
	  	})
	  	$(".msg_confirm").click(function(){
	  	     $('.mask_div').remove()
	  	     $('.msgWin').remove()
	  	})
	  	$(".msg_cancel").click(function(){
	  	     $('.mask_div').remove()
	  	     $('.msgWin').remove()
	  	})
	}
	
	})
   
   </script>
  </head>
  
  <body>
    This is my HTML page. <br>
  </body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值