- 阅读权限
- 255
- 威望
- 0 级
- 论坛币
- 50299 个
- 通用积分
- 84.1867
- 学术水平
- 258 点
- 热心指数
- 305 点
- 信用等级
- 213 点
- 经验
- 41518 点
- 帖子
- 3256
- 精华
- 14
- 在线时间
- 766 小时
- 注册时间
- 2006-5-4
- 最后登录
- 2022-11-6
|
- Listing 2.3 Changing the CSS Class
- 01 <html >
- 02 <head>
- 03 <meta http-equiv="Content-Type"
- 04 content="text/html; charset=utf-8" />
- 05 <title>The second jQuery example</title>
- 06 <link type="text/css" rel="stylesheet"
- 07 href="lib/ch2_2.css" />
- 08 <script type="text/javascript"
- 09 src="lib/jquery-1.8.2.min.js"></script>
- 10 <script type="text/javascript">
- 11 $(document).ready(function(){
- 12 $("#a").click(function(){
- 13 $("#c").addClass("mClass");
- 14 });
- 15 $("#b").click(function(){
- 16 $("#c").removeClass("mClass");
- 17 });
- 18 });
- 19 </script>
- 20 </style>
- 21 </head>
- 22 <body>
- 23 <h1>Editing Style Sheets with jQuery</h1>
- 24 <button id="a">Add CSS class</button>
- 25 <button id="b">Remove CSS class</button><hr/>
- 26 <div id="c">He who knows all the answers
- 27 has not been asked all the questions.
- 28 </div><hr/>
- 29 <div id="c">Be not afraid of going slowly,
- 30 be afraid only of standing still.</div>
- 31 </body>
- 32 </html>
复制代码
|
|