HTML
<!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></head><body>
<div class="imgover">
<p>aaaaaaaaaaaaaaaaaa<a href="#">aaaaaaaaaaaa</a></p>
</div>
</body>
</html>CSS
.hover{
color:#00FF00;
font-size:30px
}
.out{font-size:23px;
color:#FF00FF
}
JS $("a").hover(
function (){$(this).addClass("hover"),
function (){$(this).removeClass("hover")}}
)我不知道怎么触发这个事件。
之间还写了一个是$(function(){$("a").hover(
function (){$(this).addClass("hover"),
function (){$(this).removeClass("hover")}}
)
})鼠标滑过的时候有变化,但是效果不对。
<!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></head><body>
<div class="imgover">
<p>aaaaaaaaaaaaaaaaaa<a href="#">aaaaaaaaaaaa</a></p>
</div>
</body>
</html>CSS
.hover{
color:#00FF00;
font-size:30px
}
.out{font-size:23px;
color:#FF00FF
}
JS $("a").hover(
function (){$(this).addClass("hover"),
function (){$(this).removeClass("hover")}}
)我不知道怎么触发这个事件。
之间还写了一个是$(function(){$("a").hover(
function (){$(this).addClass("hover"),
function (){$(this).removeClass("hover")}}
)
})鼠标滑过的时候有变化,但是效果不对。
<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="jquery.js"></script>
<style type="text/css">
.hover{
color:#00FF00;
font-size:30px
}
.out{font-size:23px;
color:#FF00FF
}
</style>
</head><body>
<div class="imgover">
<p>aaaaaaaaaaaaaaaaaa<a href="#">aaaaaaaaaaaa</a></p>
</div></body>
</html>
<script type="text/javascript">
$("a").mouseover(function(){$(this).toggleClass("out");$(this).addClass("hover");});
$("a").mouseout(function(){$(this).toggleClass("hover");$(this).addClass("out");});
</script>