<!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>
制作弹窗遮罩效果
最新推荐文章于 2019-06-28 09:35:15 发布