Results 1 to 2 of 2

Thread: Checkbox

  1. #1
    Join Date
    Dec 1969

    Default Checkbox

    If i got two checkbox of the same name eg access, how do i set each of them checked based on certain value in script tag.. below is my codes.. can anyone tell me what&#039s wroong??? Thks<BR><BR>if (getAccess==0)<BR> document.userForm.Access(1).checked; //Set the Yes Option<BR>else<BR> document.userForm.Access(0).checked; //Set the No Option<BR><BR>

  2. #2
    MR.J Guest

    Default RE: Checkbox

    It depends on what you&#039re using the checkboxes for. If both can be checked at the same time, it would be better not to name them the same. It is easier to distinguish between the two checkboxes in this manner. <BR><BR>If they cannot be checked at the same time, you are better off using radio buttons. In this case, using JavaScript, the only thing in your code to change would be the following:<BR><BR>if (getAccess==0){<BR>document.userForm.Access[1].checked; //Set the Yes Option<BR>}<BR>else{<BR>document.userForm.Access[0].checked; //Set the No Option<BR>}<BR><BR>JavaScript uses square brackets and VBScript uses the round brackets and you can&#039t forget to use the following type of brackets - "{" to open and "}" to close.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts