[新着] Webテンプレートを仮オープンしました
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<script type="text/javascript">
<!--
function calc(fm)
{
var ten = 0;
var ele;
for(e=0; e<fm.elements.length; e++)
{
ele = fm.elements[e];
if(ele.type == "checkbox" && ele.checked)
{
ten += Number(ele.value);
}
}
fm.total.value = ten;
}
//-->
</script>
</head>
<body>
<form action="#" method="get">
<input type="checkbox" value="100" onclick="calc(this.form);" />
<input type="checkbox" value="50" onclick="calc(this.form);" />
<input type="checkbox" value="20" onclick="calc(this.form);" />
<input type="checkbox" value="9999" onclick="calc(this.form);" />
<input type="checkbox" value="1" onclick="calc(this.form);" />
<input type="text" name="total" />
</form>
<form action="#" method="get">
<input type="checkbox" value="33" onclick="calc(this.form);" />
<input type="checkbox" value="32" onclick="calc(this.form);" />
<input type="checkbox" value="111" onclick="calc(this.form);" />
<input type="checkbox" value="-500" onclick="calc(this.form);" />
<input type="checkbox" value="22222" onclick="calc(this.form);" />
<input type="text" name="total" />
</form>
</body>
</html><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<script type="text/javascript">
//<![CDATA[<!--
function calc(fm)
{
var ten = 0;
var ele;
for(e=0; e<fm.elements.length; e++)
{
ele = fm.elements[e];
if(ele.type == "checkbox" && ele.checked)
{
ten += Number(ele.value);
}
}
fm.total.value = ten;
}
//-->]]>
</script>
</head>
<body>
<form action="#" method="get">
<input type="checkbox" value="100" onclick="calc(this.form);" />
<input type="checkbox" value="50" onclick="calc(this.form);" />
<input type="checkbox" value="20" onclick="calc(this.form);" />
<input type="checkbox" value="9999" onclick="calc(this.form);" />
<input type="checkbox" value="1" onclick="calc(this.form);" />
<input type="text" name="total" />
</form>
<form action="#" method="get">
<input type="checkbox" value="33" onclick="calc(this.form);" />
<input type="checkbox" value="32" onclick="calc(this.form);" />
<input type="checkbox" value="111" onclick="calc(this.form);" />
<input type="checkbox" value="-500" onclick="calc(this.form);" />
<input type="checkbox" value="22222" onclick="calc(this.form);" />
<input type="text" name="total" />
</form>
</body>
</html><html>
<head>
<title>Untitled Page</title>
<script type="text/javascript">
<!--
function calc(fm)
{
var ten = 0;
var ele;
for(e=0; e<fm.elements.length; e++)
{
ele = fm.elements[e];
if(ele.type == "checkbox" && ele.checked)
{
ten += Number(ele.value);
}
}
fm.total.value = ten;
}
//-->
</script>
</head>
<body>
<form action="#" method="get">
<input type="checkbox" value="100" onclick="calc(this.form);">
<input type="checkbox" value="50" onclick="calc(this.form);">
<input type="checkbox" value="20" onclick="calc(this.form);">
<input type="checkbox" value="9999" onclick="calc(this.form);">
<input type="checkbox" value="1" onclick="calc(this.form);">
<input type="text" name="total">
</form>
<form action="#" method="get">
<input type="checkbox" value="33" onclick="calc(this.form);">
<input type="checkbox" value="32" onclick="calc(this.form);">
<input type="checkbox" value="111" onclick="calc(this.form);">
<input type="checkbox" value="-500" onclick="calc(this.form);">
<input type="checkbox" value="22222" onclick="calc(this.form);">
<input type="text" name="total">
</form>
</body>
</html>