当鼠标移动时出现特效的JQuery代码
代码如下:
<%@ page language="java" import="java.util.*" pageencoding="utf-8"%>
<html>
<head>
<style type="text/css">
*{
text-align: center;
font-size: 12px;
}
table{
border-collapse: collapse;
width: 40%;
}
table tr td{
border: red solid 1px;
line-height:20px;
}
.myclass,.mystu{
display: none;
}
.myclass table tr td,.mystu table tr td
{
border-top: solid 0px red;
}
</style>
//导入jquery包
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
//写jquery事件控制页面
<script type="text/javascript">
$(function(){
//事件注入点
$("#p1").mouver(function(){
$(".myclass").show("slow");
$(".mystu").hide();
$(this).css("background-color","#ccff99");
$("#p2").css("background-color","#ffffff");
});
$("#p2").mouseover(function(){
$(".mystu").show("slow");
$(".myclass").hide();
$(this).css("background-color","#ccff99");
$("#p1").css("background-color","#ffffff");
});
});
</script>
</head>
<body>
<p class="mytop">
<table align="center">
<tr>
<td id="p1">班级管理</td>
<td id="p2">学生管理</td>
</tr>
</table>
</p>
<p class="myclass">
<table align="center">
<tr>
<td>班级编号</td>
<td>班级名称</td>
<td>备注</td>
</tr>
<tr>
<td>a1331</td>
<td>java</td>
<td>优秀</td>
</tr>
<tr>
<td>a1332</td>
<td>java web</td>
<td>优秀</td>
</tr>
</table>
</p>
<p class="mystu">
<table align="center">
<tr>
<td>编号</td>
<td>姓名</td>
<td>性别</td>
<td>所在班级</td>
</tr>
<tr>
<td>100</td>
<td>程博文</td>
<td>男</td>
<td>a1339</td>
</tr>
<tr>
<td>101</td>
<td>胡晓丽</td>
<td>女</td>
<td>a1339</td>
</tr>
</table>
</p>
</body>
</html>
推荐阅读