javascript 关于弹出关闭的例子

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
body{ position:relative;}
.wang{ 100%; height:100%; background:#CCC; display:none; z-index:10; position:fixed; top:0px; left:150px; margin:0 auto; left:inherit; padding:0;filter:alpha(opacity=60); /* 针对IE浏览器的透明度 */
    opacity:0.6; /* 针对FF浏览器的透明度 */}
.wang ul{ 100px; height:100px; margin:0 auto;}    
</style>
</head>

<body>
<a onclick="dianji()">弹出</a><input type="text" />
<div class="wang" id="xian" onclick="guanbi()"><ul><form><label>姓名</label><input id="wangyan" type="text" /><br /><label>密码</label><button style="100px; height:100px;" onclick="guanbi(this)">关闭</button></form></ul></div>
<script type="text/javascript">
function dianji(){
    x=document.getElementById("xian");
    x.style.display="block";
    return false;
    }
    function guanbi(name){
    var c=document.getElementById("wangyan").value;
    if(c==3){
        
    x.style.display='none';
    return false;
    }    
    }
</script>
</body>
</html>

原文地址:https://www.cnblogs.com/baikaishui/p/2342930.html