js 点击一个按钮出现一个div然后在点击div以外的任何地方在让div隐藏怎么写
<html><head><metacharset="UTF-8"/><styletype="text/css">.d{width:100px;height:100px;b...
<html>
<head>
<meta charset="UTF-8"/>
<style type="text/css">
.d{
width: 100px;
height: 100px;
background: black;
display: none;
}
</style>
<script type="text/javascript">
</script>
</head>
<body>
<div class="d"></div>
<input type="button" value="按钮" id="anniu"/>
</body>
</html> 展开
<head>
<meta charset="UTF-8"/>
<style type="text/css">
.d{
width: 100px;
height: 100px;
background: black;
display: none;
}
</style>
<script type="text/javascript">
</script>
</head>
<body>
<div class="d"></div>
<input type="button" value="按钮" id="anniu"/>
</body>
</html> 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询