check a checkbox with java script
Good afternoon/evening all.
Here's the deal: I have a list of checkboxes within a form and I need to ensure that one checkbox CANNOT be unchecked.
So, if a user clicks this particular checkbox, I execute a java script function and display a message, "You cannot uncheck this checkbox."
After the message appears on the screen, the checkbox becomes unchecked. I would like my java script to check it back for me, but it doesn't. How can I code java script so that it checks the checkbox?
thanks for your help!
sal
Here's the checkbox:
<INPUT type=checkbox name=chkCSHuser onclick=securityAdminUnchecked(); value=cmain\rotondos checked >Salvatore Rotondo (Admin)
Here's the javascript function:
<script language="JavaScript">
<!--
function securityAdminUnchecked()
{
alert ("You cannot uncheck this user.\nUser is an administrator.");
document.frmWebsiteSecurity.chkCSHuser.checked;
}
//-->
</SCRIPT>
|