js弹窗 js弹出DIV,并使整个页面背景变暗

1.首先写一个遮罩层div,然后再写一个弹窗的div


<div id="cover" style="background: #000; position: absolute; left: 0px; top: 0px; width: 100%;  filter: alpha(opacity=30); opacity: 0.3; display: none; z-index: 2 ">
    
div>


<div id="showdiv" style="width: 80%; margin: 0 auto; height: 9.5rem; border: 1px solid #999; display: none; position: absolute; top: 40%; left: 10%; z-index: 3; background: #fff">
    
    <div style="background: #F8F7F7; width: 100%; height: 2rem; font-size: 0.65rem; line-height: 2rem; border: 1px solid #999; text-align: center;" >
        提示
    div>
    
    <div style="text-indent: 50px; height: 4rem; font-size: 0.5rem; padding: 0.5rem; line-height: 1rem; ">div>
    
    <div style="background: #418BCA; width: 80%; margin: 0 auto; height: 1.5rem; line-height: 1.5rem; text-align: center;color: #fff;margin-top: 1rem; -moz-border-radius: .128rem; -webkit-border-radius: .128rem; border-radius: .128rem;font-size: .59733rem;" onclick="closeWindow()">
        确 定
    div>
div>

 

js代码:(把jq引进来)

 

 

效果:

js弹窗 js弹出DIV,并使整个页面背景变暗_第1张图片

 

转载于:https://www.cnblogs.com/zxf100/p/8900787.html

你可能感兴趣的:(js弹窗 js弹出DIV,并使整个页面背景变暗)