<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
/*jQuery hide()方法*/
$("#testHide").click(function(){
$("#testValue").hide();
});
/*jQuery show()方法*/
$("#testShow").click(function(){
$("#testValue").show();
});
/*jQuery toggle()方法*/
$("#testToggle").click(function(){
$("#testValue2").toggle();
});
/*测试一下hide()方法*/
$(".ex .predi").click(function(){
$(this).parents(".ex").hide("slow");
});
});
</script>
<style type="text/css">
div.ex
{
background-color:#e5eecc;
padding:7px;
border:solid 1px #c3c3c3;
}
</style>
</head>
<body>
<p id="testValue">今天是开心、快乐的日子</p>
<button id="testHide">隐藏</button>
<button id="testShow">显示</button><br/><br/>
<button id="testToggle">隐藏、显示</button>
<p id="testValue2">
<tr>星期一</tr><br/>
<tr>星期二</tr>
</p>
<div class="ex">
<button class="predi">天气预报</button>
<p>
<tr>明天上午天气晴朗,阳光明媚</tr><br>
<tr>后台天气舒适</tr>
</p>
</div>
</body>
</html>
jQuery3
最新推荐文章于 2024-05-14 02:46:32 发布