鼠标经过事件

来源:互联网 发布:nginx 单ip 多域名 编辑:程序博客网 时间:2024/04/30 10:49
<html>
<head>
<title>鼠标经过事件</title>
</head>
<script src="jquery-1.3.1.js" type="text/javascript">
</script>
<style type="text/css">
.orange{
background-color:blue;
font-size:20px;
}
.bo{
background-color:#ff8800;
font-size:20px;
}
</style>
<script type="text/javascript">
//jQuery的格式:$(function(){
//   });
 $(function(){
 $("ul li:eq(1)").mouseover(function(){
 $("ul li:eq(1)").addClass("orange")
 });
  $("ul li:eq(1)").mouseout(function(){
  $("ul li:eq(1)").removeClass("orange")
  });
  $("ul li:eq(1)").click(function(){
   $("ul li:eq(1)").toggleClass("bo")
  });
 });
</script>
<body>
 <ul>
  <li title='苹果'>苹果</li>
  <li title='橘子'>橘子</li>
  <li title='菠萝'>菠萝</li>
 </ul>
</body>
</html>
原创粉丝点击