01.
<html>
02.
<head>
03.
<title>ThaiCreate.Com Tutorial</title>
04.
</head>
05.
<body>
06.
<script language=
"javascript"
>
07.
function
fncSubmit()
08.
{
09.
for
(i=1;i<=document.form1.hdnLine.value;i++)
10.
{
11.
if
(eval(
"document.form1.chk"
+i+
".checked"
)==
false
)
12.
{
13.
alert(
"Please Click Checkbox "
+i+
" Thank."
);
14.
return
false
;
15.
}
16.
}
17.
document.form1.submit();
18.
}
19.
</script>
20.
<form action=
"page.cgi"
method=
"post"
name=
"form1"
onSubmit=
"JavaScript:return fncSubmit();"
>
21.
Checkbox 1 <input name=
"chk[]"
type=
"checkbox"
id=
"chk1"
value=
"Y"
><br>
22.
Checkbox 2 <input name=
"chk[]"
type=
"checkbox"
id=
"chk2"
value=
"Y"
><br>
23.
Checkbox 3 <input name=
"chk[]"
type=
"checkbox"
id=
"chk3"
value=
"Y"
><br>
24.
Checkbox 4 <input name=
"chk[]"
type=
"checkbox"
id=
"chk4"
value=
"Y"
><br>
25.
Checkbox 5 <input name=
"chk[]"
type=
"checkbox"
id=
"chk5"
value=
"Y"
><br>
26.
<input type=
"hidden"
name=
"hdnLine"
value=
"5"
>
27.
<input name=
"btnSubmit"
type=
"submit"
value=
"Submit"
>
28.
</form>
29.
</body>
30.
</html>