SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2010
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    controlling checkboxes

    Hi,
    I need your help!!
    I have checkboxes (Delete and Update) on a table.

    update delete id
    - - xx
    - - xx2
    n n n


    The code below makes sure only one of the two check boxes are checked at a given time. So, either you can delete or Update but can't do both at the same.
    Now, in addition to current functionality, I need to be able to delete or update more than one record - How can I do this.
    Any help is appreciated.
    Thank you.


    function Check(pass)
    {
    var divElement=document.getElementById('mytble');
    var arrCheckElements = divElement.getElementsByTagName('input');
    for(var i=0;i<arrCheckElements.length;i++)
    {

    arrCheckElements[i].checked =false;
    }

    document.getElementById(pass).checked =true;


    }
    <td><input type=checkbox id="chkde" onclick="Check(this.id)" value=""></td>
    <td><input type=checkbox id="chkup" onclick="Check(this.id)" value=""></td>

  2. #2
    SitePoint Wizard
    Join Date
    Dec 2003
    Location
    USA
    Posts
    2,582
    Mentioned
    29 Post(s)
    Tagged
    0 Thread(s)
    Just following up on pinkcandy's post, she's dead-on.

    Anytime you have a small collection of options in which you can only choose one, a radio button is always a good choice (along with single selects, but that's better for larger sets).


Bookmarks

Posting Permissions

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