<!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>
<style type="text/css">
p{margin:0;padding:0;}
body{font-size:12px;}
.myclass{font-weight:bold;}
.add{text-decoration:underline;color:#F00;}
</style>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(function(){
//更改样式
//$("p").attr("class","fruit");//这只P元素的class为fruit
//追加样式
//$("p").addClass("add")//-----------给p属性追加一个样式(add);在给p追加样式之前,先把样式在样式表中写出来
})
</script>
</head>
<body>
<p class="myclass" title="你最喜欢的是">你最喜欢的是</p>
</body>
</html>