jquery单个按钮显示隐藏div

#   jquery单个按钮显示隐藏div



<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://www.s7smile.com/" />
<title>s7smile jquery单个按钮显示隐藏div</title>
<style type="text/css">
#hidden_enent{
float:left;
  width:200px;
  height:150px;
  background:blue;
  text-align:center;
  line-height:150px;
}
.left{
width:800px;height:200px;background:#888;float:left;word-wrap:break-word;
}
</style>
<script type="text/javascript" src="jquery.js"></script> 
<script type="text/javascript">
$(function(){
  $('#click_event').click(function(){
    if($('#hidden_enent').is(':hidden')){
      $('#hidden_enent').show();
      $('#click_event').val('点击隐藏');
	  $(".left").css("width","800px");
    }
    else{
      $('#hidden_enent').hide();
      $('#click_event').val('点击显示');
	 $(".left").css("width","100%");
    }
  })
})
</script>
</head>
<body>

<div style="width:1000px;height:500px;background:#999">
<div class="left"><input type="button" id="click_event" value="点击隐藏"/></div>

<div id="hidden_enent">text</div>
</div>

</body>
</html>


# xiaoxiao [ 2015-12-23 ]

# Address in this article

# http://www.s7smile.com/javascript/7

# s7smile.com