<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>parents用法</title>
<script type="text/javascript" src="class library/jquery-1.10.2.min.js"></script>
<script>
$(document).ready(function(){
$('a').hover(function(){
$(this).parents('p').addClass('highlight');
},function(){
$(this).parents('p').removeClass('highlight');
});
});
</script>
<style>
.highlight{ background:grey; border:3px dotted #ccc;}
</style>
</head>
<body>
<p>去爱吧 胡歌<a href="#">词:王中言 曲:佐罗王</a></p>
</body>
</html>
parents()用法
最新推荐文章于 2021-11-22 23:32:56 发布