<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>隔行换色</title>
<style type="text/css">
table{
margin: auto;
}
.color {
background-color: deeppink;
}
</style>
</head>
<body>
<table border="" cellspacing="" cellpadding="">
<tr>
<th>Header</th>
<th>Header</th>
<th>Header</th>
<th>Header</th>
</tr>
<tr><td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
<tr><td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
</table>
</body>
<script type="text/javascript" src="js/jquery-3.1.1.js"> </script>
<script type="text/javascript">
var isEven = true;
$(document).click(function() {
if (isEven) {
$("tr:even").addClass("color")
$("tr:odd").removeClass("color");
}else{
$("tr:odd").addClass("color")
$("tr:even").removeClass("color");
}
isEven = ! isEven;
})
</script>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>全选/全不选</title>
</head>
<body>
<table border="" cellspacing="" cellpadding="">
<tr>
<th><input type="checkbox" class="f" name="" id="" value="" /></th>
<th>Header</th>
<th>Header</th>
<th>Header</th>
</tr>
<tr>
<td><input type="checkbox" class="s" name="" id="" value="" /></td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
<tr>
<td><input type="checkbox" class="s" name="" id="" value="" /></td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
<tr>
<td><input type="checkbox" class="s" name="" id="" value="" /></td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
<tr>
<td><input type="checkbox" class="s" name="" id="" value="" /></td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
<tr>
<td><input type="checkbox" class="s" name="" id="" value="" /></td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
</table>
</body>
<script type="text/javascript" src="js/jquery-3.1.1.js"></script>
<script type="text/javascript">
$(".f").click(function(){
$(".s").prop("checked",this.checked)
})
</script>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>动画效果</title>
<style type="text/css">
div{
width: 300px;
height: 300px;
background-color: #FF1493;
margin: 10px;
}
</style>
</head>
<body>
<div id="div1">
</div>
<div id="div2">
</div>
</body>
<script type="text/javascript" src="js/jquery-3.1.1.js"></script>
<script type="text/javascript">
$(document).click(function(){
$("div").toggle(2000);
$("div").fadeToggle(2000);
$("div").slideToggle(2000);
})
</script>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>定时循环</title>
<style type="text/css">
img{
width: 100%;
height: 1400px;
}
</style>
</head>
<body>
<img src="img/1001881.jpg"/>
</body>
<script type="text/javascript" src="js/jquery-3.1.1.js"> </script>
<script type="text/javascript">
setInterval(function(){
$("img").toggle(500)
$("img").fadeToggle(500)
$("img").slideToggle(500)
},2000)
</script>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>省市联动</title>
</head>
<body>
<select name="pro" id="pro">
<option value="">---请选择---</option>
</select>
<select name="city" id="city">
<option value="">---请选择---</option>
</select>
</body>
<script type="text/javascript" src="js/jquery-3.1.1.js"></script>
<script type="text/javascript">
var pros = ["河北省","河南省","陕西省","福建省","陕西省"];
var citys = [
["石家庄","保定","邯郸","唐山","秦皇岛"],
["洛阳","南阳","信仰","濮阳","安阳"],
["大同","临汾","太原","阳泉","运城"],
["福州","莆田","厦门","武夷山","三明"],
["济南", "青岛", "淄博", "滨州", "德州"]
];
$(pros).each(function(index,ele){
$("#pro").append($("<option value='"+ index+"'>"+ele+"</option>"));
})
$("#pro").change(function(){
$("#city Option").remove(":gt(0)");
var cs = citys[$(this).val()];
$(cs).each(function(index,ele){
$("#city").append($("<option value='"+index +"'>" +ele+ "</option>"))
})
})
</script>
</html>