<!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>jQuery 控制CSS 樣式</title><script language="javascript" type="text/javascript"src="jquery-1.3.2.min.js"></script><style type="text/css">.divDefalut{width:260px;font-size:10pt;padding:5px}.divClick{width:260px;border:solid 1px #666;font-size:10pt;background-color:#eee;padding:5px}</style><script type="text/javascript">$(function(){$(".divDefalut").click(function(){$(this).toggleClass("divClick").html(" 點擊后的樣式");});});</script></head><body><div class="divDefalut"> 點擊前的樣式</div></body></html>為什么 內同沒有回復呢,求教???
2 回答

慕萊塢森
TA貢獻1810條經驗 獲得超4個贊
<script type="text/javascript">
$(function(){
$(".divDefalut").toggle(function(){
$(this).addClass("divClick").html(" 點擊后的樣式");
},function(){
$(this).removeClass("divClick").html(" 點擊前的樣式");
});
});
</script>
這樣整!
添加回答
舉報
0/150
提交
取消