菜单切换
FACESOHO知行者
心灵
记录
远方
赞赏工具
源代码:
点击运行
保存
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>小鸟启蒙(facesoho.com)</title> <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ $("p,h1").removeClass("head intro main"); }); }); </script> <style type="text/css"> .head{ font-size:2em; color:green; } .intro{ font-size:120%; color:red; } .main{ font-size:20px; color:blue; } </style> </head> <body> <h1 class="head">这是一个标题</h1> <p class="intro">这是一个段落。</p> <p class="main">这是另一个段落。</p> <button>移除选择元素的"head", "intro" 和 "main" 类</button> </body> </html>
运行结果