-
-10 19
-
jquery中添加(addClass)删除(removeClass)样式,简单易用!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#a").mouseover(function(){
$(this).removeClass("out");
$(this).addClass("over");
}).mouseout(function(){
$(this).addClass("out");
});
});
</script>
<style>
.over{ height:20px; width:120px; border:#F00 1px solid;}
.out{ height:20px; width:120px; border:#00F 1px solid;}
</style>
</head><body>
<span id="a">点击我</span></body>
</html>
本文来源于php爱好者:php教程 —http://www.phplover.cn/
原文地址:http://www.phplover.cn/post/jquery-addClass-emoveClass.html
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。
- 评论(0)
发表评论 TrackBack