日期:2014-05-17  浏览次数:20780 次

jQuery的attr方法,问题出在哪里?求教
[code=html][<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style type="text/css">
.myClass{
color:red
}
.change:{
color:green
}
</style>
<script src="jQuery/jquery-1.10.2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("p").attr("class","change");
});
</script>
</head>
<body>
<p class="myClass" title="what kind of fruit do you like best?">你最喜欢的水果是?</p>
</body>
</html>/code]
通过浏览器访问,为什么段落的字体没有变成绿色?jquery已经引了,路径也没错。到底问题出在哪里,求教。。。

------解决方案--------------------
样式名  .change  这个后面不要加冒号