checkbox ( control )
I want to use following code in asp header and body.
this is work when field type text box.
how can I control user to click check box otherwise
if user not check the check box it should display message.
and stay same page.
I use fourteen checkbox in the asp page.
<head>
<script language="JavaScript">
function docheck()
{
for (i=0;i<=13;++i)
{
x=document.forms[0].elements[i].value
n=document.forms[0].elements[i].name
if (i==0)
{
s0=document.forms[0].elements[i].value
if (s0=="")
{
alert ("Please click the checkbox checked")
document.forms[0].elements[i].focus()
return false;
}
}
}
}
</script>
</head>
<body>
<form method=post action="http://dcilweb/DCILDepts/confview2.asp" id=myform name=myform onSubmit="return docheck()">
<table>
<tr>
<td colspan="3"><div align="left"><strong>1. Target Zero Tolerance</strong></div></td>
<td width="11%"> <div align="center">
<INPUT id=checkbox1 type=checkbox name="checkbox1" value="Target Zero Tolerance">
</div></td>
</tr>
<tr>
<td colspan="3">5.
Defensive Driving</td>
<td><div align="center">
<INPUT id=checkbox5 type=checkbox name=checkbox5 value="Defensive Driving">
</div></td>
</tr>
...
....
<INPUT type="submit" value="Confirm" id=submit12 name=submit12 title="Confirm">
</body>
when user move to this page, focus should be checkbox.
there are fourteen checkbox in this page.
how can control the user without click the checkbox it not
move to next page ?
if user check the check box then move to next page
otherwise it stay same page how ?
what changing in above coding.
user can select more then one check box.
I have to write fourteen time check box focus lines
ie
if (s1=="") then do this
if (s2=="") then do this
....
...
Please help to write the java coding.
regads.
Mateen
|