首页 > 代码库 > JQ 操作样式,背景切换

JQ 操作样式,背景切换

<!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>
<title></title>
<style type ="text/css" >


.class1
{ filter:gray;

}
</style>
<script type="text/javascript" src="http://www.mamicode.com/Scripts/jquery-1.4.1.js"></script>
<script type ="text/javascript" >
$(function() {
$("#toggleBtn").click(function() {
$(document.body).toggleClass("class1");
});
});
</script>
</head>
<body>
<img src ="http://www.mamicode.com/image/00.jpg" alt ="" style =" width :35%; height :35%" />
<input type ="button" value ="http://www.mamicode.com/切换" id ="toggleBtn" />
</body>
</html>