---
title: "JQUERY 显示隐藏div"
author: "Forestsai"
date: "2011-05-25T10:03:57Z"
tags: ["HTML", "JavaScript", "jQuery"]
categories: ["编程语言"]
slug: "jquery-div"
draft: false
lastmod: "2011-05-25T21:31:12Z"
id: 1057866
url: "https://forestsai.iteye.com/blog/1057866"
---

```
<html>  
<head>  
<title>show hide toggle</title>  
<script type='text/javascript' src="jquery/jquery-1.3.1.js"></script>  
<script language="javascript" type="text/javascript">  
    $(document).ready(function(){   
        $("#show").click(function(){   
            $("#showDiv").show(1000,alert(100));   
        });   
        $("#hide").click(function(){   
            $("#showDiv").hide(1000,alert(200));   
        });   
        $("#toggle").click(function(){   
            $("#showDiv").toggle(1000,alert(300));   
        });   
    });   
</script>  
<style>  
    .showDiv   
    {   
        width:200px;   
        height:200px;   
        border:1px red solid;   
    }   
</style>  
</head>  
  
<body>  
  
<div class="showDiv" style="display:none;" id="showDiv">show and hide</div>  
<p style="display: none">Hello</p>  
  
<input type="button" value="Show" id="show" />  
<input type="button" value="Hide" id="hide" />  
<input type="button" value="Toggle" id="toggle" />  
</body>  
</head> 
```