日期:2014-05-16 浏览次数:20420 次
<!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>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".div_input").click(function(){
$(".yc_div").toggle();
})
$(document).click(function(){
$(".yc_div").hide();
})
});
</script>
<style type="text/css">
*{
margin:0;
padding:0;
}
.div{
float:left;
position:relative;
margin:100px;
}
.div_input{
width:50px;
height:25px;
border:1px solid #DCDCDC;
}
.yc_div{
width:200px;
height:100px;
border:1px solid #00BCF3;
position:absolute;
top:0;
left:52px;
display:none;
}
</style>
</head>
<body>
<div class="div">
<input class="div_input" id="test1" type="text"/>
<div id="yc_div" class="yc_div"></div>
</div>
</body>
</html>
刚刚开始是隐藏的 怎么才能我点击input框 div出现 在点击空白的地方 div消失