01.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=windows-874"
/>
02.
03.
<script language=
"javascript"
>
04.
function
fnccheck(){
05.
var
t;
06.
var
sum=0;
07.
var
ch = document.form1.elements[
'chk[]'
];
08.
var
txt = document.form1.elements[
'text[]'
];
09.
var
lenContact = ch.length;
10.
for
(i =0;i<lenContact;i++)
11.
{
12.
if
(ch[i].checked == true)
13.
{
14.
document.getElementById(
'tet'
+ i).value = txt[i].value;
15.
sum = parseFloat(document.getElementById(
'tet'
+ i).value)+sum;
16.
}
17.
18.
}
19.
document.form1.total.value=sum;
20.
21.
}
22.
</script>
23.
<form action=
"calcheck.php"
method=
"post"
name=
"form1"
>
24.
<?
for
(
$i
=0;
$i
<1;
$i
++)
25.
{
26.
?>
27.
text: <input type=
"text"
name=
"text[]"
id=
"text[]"
value=
"2"
/>tet : <input type=
"text"
name=
"text1[]"
id=
"tet<? echo $i?>"
value=
"10"
size=
"5"
>Checkbox
28.
<input name=
"chk[]"
type=
"checkbox"
id=
"chk[]"
value=
"Y"
OnClick=
"fnccheck();"
>
29.
<br>
30.
<?
31.
}
32.
?>
33.
<input type=
"text"
name=
"total"
id=
"total"
/>
34.
<input name=
"save"
type=
"submit"
id=
"save"
value=
"save"
/>
35.
</form>