һ
 ע

QQ¼

ֻһٿʼ

ƼĶ

+
̳ WEBҳǰ뿪 ǰ̨ű

jqueryʵֵƷͼƷ

[]
15940 happy175 2014-6-7 21:46:30
| ʾȫ¥
1F

ϵ½עᣬύѣø๦ܣϴزIJޣ

Ҫ ¼ ſػ鿴ûʺţע  

x


  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>ޱĵ</title>
  6. <script type="text/javascript" src="../jquery-1.9.1.min.js"></script>
  7. <style type="text/css">
  8. .num_box{width:100%;float:left;}
  9. .num_box a{width:20px;text-align:center;cursor:pointer;}
  10. .num_box a:hover{background:#f0f0f0;}
  11. .num_box a:active{background:#E3E3E3;}
  12. .num,.num_box a{height:20px;line-height:20px;border-color:#ccc;border-style:solid;color:#333;float:left;}
  13. .num{border-width:1px;text-align:left;text-indent:5px;line-height:15px\9;padding:0;margin:0;width:100px;}
  14. .J_jia{border-width:1px 0 1px 1px;border-radius:3px 0 0 3px;}
  15. .J_jian{border-width:1px 1px 1px 0;border-radius:0 3px 3px 0;}
  16. </style>
  17. </head>
  18. <body>
  19. <p class="num_box"><a class="J_jia">+</a><label><input type="text" class="num" /></label><a class="J_jian">-</a></p>
  20. <script type="text/javascript">
  21. $(document).ready(function(){
  22. var add,reduce,num,num_txt;
  23. add=$(".J_jia");//
  24. reduce=$(".J_jian");//
  25. num="";//ʼֵ
  26. num_txt=$(".num");//ı
  27. //var num_val=num_txt.val();//ıϳʼֵ

  28. /*ķ*/
  29. add.click(function(){
  30. num = $(".num").val();
  31. num++;
  32. num_txt.val(num);
  33. //ajaxԷﴫݵݿʵʱıܼ
  34. });

  35. /*ķ*/
  36. reduce.click(function(){
  37. //ıֵ0ִмȥ
  38. num = $(".num").val();
  39. if(num >0){
  40. //ҵıֵΪ1ʱ򣬼ȥıֱֵʾ0
  41. if(num==1)
  42. { num--;
  43. num_txt.val("");
  44. }
  45. //ִм
  46. else
  47. {
  48. num--;
  49. num_txt.val(num);
  50. }

  51. }
  52. });
  53. })
  54. </script>

  55. </body>
  56. </html>
ƴ


Դ΢http://weibo.com/techued Դ΢Źںţweb-tech
ʹõ ٱ ظ
б

ֹ

²

̳¡ͼƬѷϴվԭתԻ,µİȨԭ
վַİȨ֪ͨǵĹԱ,Ա(Email:admin@websjy.com)ʱȡȨɾ
ܾκκʽڱ̳л񹲺͹ִ!

QQ| 42011102000510|Archiver|ֻ|Դ ( ICP14013341-1

GMT+8, 2018-7-17 14:05

Powered by Discuz! X3.2

ԴԴվ  ԴAPPӦ֮

ٻظ ض б