<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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 runat="server">
<title>MyTest</title>
<script type="text/javascript" src="js/jquery-1.3.min.js"></script>
<script type="text/javascript">
//$(function(){$("p").css("color","red");$("p").click(function(){alert("df");});});
$(function(){
//取标签 设置样式属性键:值 形式
$("p").eq(0).css({"color":"blue","background":"blue","background-color":"lightBlue"})
//id前加#
$("#tt2").css({"color":"red","background":"blue","background-color":"lightBlue"})
$("p").click(function(){alert($("p").css("color"));})
}
);
function tt(){
var val = $("p").css("color");
alert(val);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<p id="tt">good</p>
<p id="tt2">luck</p>
<input type="button" value="test" />
</div>
</form>
</body>
</html>
“七”乐无穷,尽在新浪新版博客,快来体验啊~~~请点击进入~