Thread: Check box .....

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    65
    Rep Power
    15
    Hi, i have a problem. Can someone help me please......

    I want to check every checked checkbox in one form. The name is almost same, only last character not, can i use for loop to check it?? The for loop is like below...

    var checkcount;
    function checktech()
    {
    for (i=1; i<27; i++)
    {
    var the_box = document.form1.techbox[i];
    if(the_box.checked == true)
    {
    checkcount = checkcount+1;
    }
    if(checkcount > 3)
    {
    alert("Please select no more than 3 option.");
    }
    }//end for
    }//end function

    <input type="checkbox" name="techbox1" onClick="checktech();" value="eq" >

    <input type="checkbox" name="techbox2" onClick="checktech();" value="ga">
    ....
    ....
    until 26 check box
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Location
    SPAIN
    Posts
    47
    Rep Power
    16
    Change

    var the_box = document.form1.techbox[i];

    by

    var the_box = eval('document.form1.techbox'+i);

    and I think that it will work

Similar Threads

  1. Access: list box/combo box "After Update" problems
    By hlove in forum Database Management
    Replies: 2
    Last Post: January 2nd, 2004, 01:22 AM
  2. to update value of check box into a database
    By jitender in forum ASP Programming
    Replies: 0
    Last Post: November 14th, 2003, 12:57 AM
  3. changing the buttons in the message box
    By crackerweb in forum Visual Basic Programming
    Replies: 6
    Last Post: October 23rd, 2003, 06:36 PM
  4. syntax for selecting check box??
    By fimbria in forum PHP Development
    Replies: 3
    Last Post: June 23rd, 2003, 05:42 AM
  5. check box challenge
    By bender in forum ASP Programming
    Replies: 1
    Last Post: June 9th, 2003, 07:34 AM

IMN logo majestic logo threadwatch logo seochat tools logo