自制提示弹窗
###自制提示弹窗
```
/*弹窗样式*/
.alertBox{
background: #CCE8CF none repeat scroll 0 0;
border: 1px solid #696969;
color: #000;
height: 145px;
left: 41%;
font-size:14px;
position: fixed;
top: 80px;
width: 245px;
-webkit-border-radius:3px;
-moz-border-radius:3px;
border-radius: 3px;
z-index:1000;
}
.alertBox p{
text-align: center;
height:70px;
line-height:70px;
clear: both;
width:100%;
}
.alertBox .btnSure{
text-align: center;
padding:20px 0;
clear: both;
width:100%;
height:60px;
background: #C2DCC4;
position: relative;
}
.alertBox .btnSure button{
text-align: center;
padding:0 20px;
position: absolute;
right:20px;
}
.filter{
width:100%;
height:100%;
position:fixed;
top:0;
left:0;
background: #000;
opacity:0.3;
z-index:998;
}
```
```js
function alertMsg(msg) {//弹窗提示
var $alertBox = '<div class="alertBox"><p>'+msg+'</p><div class="btnSure"> <button type="button" onclick="hideAlertBox();">确定</button> </div></div>';
var $filter = '<div class="filter"></div>';
$('body').append($alertBox).append($filter);
}
function hideAlertBox() {//关闭弹窗
$('.alertBox,.filter').hide();
}
```