jQuery 抄袭笔记(18) :加减
20 Oct 2011
01 <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
02 “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
03 <html xmlns=“http://www.w3.org/1999/xhtml” xml:lang=“en-us”>
04 </span>
05</span>Hello Lazynight!</title>
06 <script src=“jquery-1.1.3.pack.js”></script>
07
08 $(document).ready(function(){
09 $(“#add”).click(function(){
10 var n=$(“#number”).html();
11 var m=parseInt(n)+1;
12 if(m==){alert(“不能为0~~”);return}
13 $(“#number”).html(m);
14 });
15 $(“#subtract”).click(function(){
16 var n=$(“#number”).html();
17 var m=parseInt(n)-1;
18 if(m==){alert(“不能为0~~”);return}
19 $(“#number”).html(m);
20 });
21 });
22
23 </head>
24 </span>
25 <div id=“number”>5</div>
26 <input type=“button” id=“add” value=“+”/>
27 <input type=“button” id=“subtract” value=“-”/>
28 </body>
29 </html> </div> 下载源码 转载请注明:[于哲的博客][1] » [jQuery 抄袭笔记(18) :加减][2] [1]: http://lazynight.me [2]: http://lazynight.me/580.html
02 “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
03 <html xmlns=“http://www.w3.org/1999/xhtml” xml:lang=“en-us”>
04 </span>
05
06 <script src=“jquery-1.1.3.pack.js”></script>
07
08 $(document).ready(function(){
09 $(“#add”).click(function(){
10 var n=$(“#number”).html();
11 var m=parseInt(n)+1;
12 if(m==){alert(“不能为0~~”);return}
13 $(“#number”).html(m);
14 });
15 $(“#subtract”).click(function(){
16 var n=$(“#number”).html();
17 var m=parseInt(n)-1;
18 if(m==){alert(“不能为0~~”);return}
19 $(“#number”).html(m);
20 });
21 });
22
23 </head>
24 </span>
25 <div id=“number”>5</div>
26 <input type=“button” id=“add” value=“+”/>
27 <input type=“button” id=“subtract” value=“-”/>
28 </body>
29 </html> </div> 下载源码 转载请注明:[于哲的博客][1] » [jQuery 抄袭笔记(18) :加减][2] [1]: http://lazynight.me [2]: http://lazynight.me/580.html