标签:des io java ar for sp cti on html
<input type="checkbox" name="all" onclick="checkAll(this)"/>全选<br />
<input type="checkbox" name="item" value="3000" />3000<br />
<input type="checkbox" name="item" value="3000" />3000<br />
<input type="checkbox" name="item" value="3000" />3000<br />
<input type="checkbox" name="item" value="3000" />3000<br />
<input type="checkbox" name="item" value="3000" />3000<br />
<input type="checkbox" name="item" value="3000" />3000<br />
<input type="checkbox" name="item" value="3000" />3000<br />
<input type="button" value="总和" onclick="getSum(this)"/> <span id="spanId"></span>
<script type="text/javascript">
function getSum()
{
var itemNodes = document.getElementsByName("item");
var sum = 0;
for(var i=0; i<itemNodes.length; i++)
{
if(itemNodes[i].checked)
{
sum += parseInt(itemNodes[i].value);
}
}
var spanNode = document.getElementById("spanId");
var str = sum + "元";
spanNode.innerHTML = str.fontsize(10);
}
function checkAll(checkallNode)
{
var itemNodes = document.getElementsByName("item");
for(var i=0; i<itemNodes.length; i++)
{
itemNodes[i].checked = checkallNode.checked;
}
}
</script>
标签:des io java ar for sp cti on html
原文地址:http://www.cnblogs.com/qinxuemei/p/3969093.html