1、新建HTML文件

3、创建css样式

5、预览效果图

7、当点击按钮样式切换

9、再点击按钮,效果变回之前的效果,附上源码<script>$(function()辘腋粪梯{ $("button").click(熠硒勘唏function(){ $("div").toggleClass("blue"); });});</script></head><style>.red{ width:400px; height:200px; line-height:200px; color:#0F0; background:#F33;}.blue{background:#0F0; color:#FFF;}</style>
