html5实现全选按钮,及统计所选择商品的总价并输出
现有一个商品选择列表(复选框),HTML代码及效果如下:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<div>商品列表</div>
<input type="checkbox" name="item" value="3000" />笔记本电脑<br/>
<input type="checkbox" name="item" value="3000" />笔记本电脑<br/>
<input type="checkbox" name="item" value="3000" />笔记本电脑<br/>
<input type="checkbox" name="all" οnclick="checkAll(this)" />全选<br/>
<input type="button" value="总金额:" οnclick="getSum()" /><span id="sumid"></span>
</body>
</html>