写完的代码和示例代码一样可是为什么一个改变的是字体颜色一个是背景色?
2 回答
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>hover()方法切换事件</title>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
</head>
<body>
<h3>hover()方法切换事件</h3>
<div>别走!你就是土豪</div>
<script type="text/javascript">
$(function () {
$("div").hover(
function () {
$(this).addClass("orange");
},
function () {
$(this).removeClass("orange")
})
});
</script>
</body>
</html>
举报
0/150
提交
取消