首页 > 其他 > 详细

input多选计算

时间:2016-08-05 22:50:26      阅读:411      评论:0      收藏:0      [点我收藏+]
CSS代码:

body {
  counter-reset: icecream;
}
input:checked {
  counter-increment: icecream;
}
.total::after {
  content: counter(icecream);
}
HTML代码:

<strong>下面中国十大冰淇淋你吃过几个?</strong>
<ol>
    <li><input type="checkbox" id="icecream1"><label for="icecream1">哈根达斯</label></li>
    <li><input type="checkbox" id="icecream2"><label for="icecream2">和路雪wall‘s</label></li>
    <li><input type="checkbox" id="icecream3"><label for="icecream3">八喜冰淇淋</label></li>
    <li><input type="checkbox" id="icecream4"><label for="icecream4">DQ冰淇淋</label></li>
    <li><input type="checkbox" id="icecream5"><label for="icecream5">蒙牛冰淇淋</label></li>
    <li><input type="checkbox" id="icecream6"><label for="icecream6">雀巢冰淇淋</label></li>
    <li><input type="checkbox" id="icecream7"><label for="icecream7">伊利冰淇淋</label></li>    
    <li><input type="checkbox" id="icecream8"><label for="icecream8">乐可可冰淇淋</label></li>
    <li><input type="checkbox" id="icecream9"><label for="icecream9">新城市冰淇淋</label></li>
    <li><input type="checkbox" id="icecream10"><label for="icecream10">明治MEIJI</label></li>
</ol>
你总共选择了 <strong class="total"></strong> 款冰淇淋! 
技术分享

 

技术分享

input多选计算

原文:http://www.cnblogs.com/520lin/p/5742787.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!