<html>
<head>
<script type="text/javascript" src="http://www.w3school.com.cn/jquery/jquery.js"></script>
<style>
.bg1 {
background-image:url(21.jpg);
}
.bg2 {
background-image:url(22.jpg);
}
</style>
<script type="text/javascript">
function toggle1(){
if ($("#btn1").attr("class")=="bg1"){
$("#btn1").attr("class","bg2");
}
else
{
$("#btn1").attr("class","bg1");
}
$("#p1").toggle();
}
</script>
</head>
<body>
<p id="p1">This is a paragraph.</p>
<p class="bg1" id="btn1" onClick="toggle1()">ToggleToggleToggleToggleToggleToggleToggleToggleToggleToggleToggleToggleToggleToggle</p>
</body>
</html>
本文出自 “一路凯歌” 博客,请务必保留此出处http://cag2050.blog.51cto.com/1009647/1721359
原文地址:http://cag2050.blog.51cto.com/1009647/1721359