SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Location
    sri lanka
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    multiple check boxes select

    hi
    need a java script help
    inside my page there are several check boxes inside a loop where i can select the record by checking the checkboxes,the check box name is same inside the loop,i need to get the value of the check box allowing the user to select multiple check boxes at a time

    here is my coding

    PHP Code:
     if not rs.BOF or not rs.EOF then
                                    
                                  
    do while not rs.EOF and  iRecordsShown iPageSize     
                                  
                                 
    %>   
                                                                
                                  <
    tr>
                                    <
    td width="15">&nbsp;</td>
                                    <
    td width="50" bgcolor="#FFFDF0" align="center"><font class="smalltxt" size="2" face="Verdana"><input type="checkbox" name="C1"  id="C1" value= <% = rs.Fields("cusid") %>></font></td>
                                    <
    td width="115" bgcolor="#FFFDF0" valign="top"><font class="smalltxt">&nbsp;<% =rs.Fields("Cusid")%></font></td>
                                    <
    td width="173" bgcolor="#FFFDF0" valign="top"><font class="smalltxt">&nbsp;<% =rs.Fields("Fullname")%></font></td>
                                    <
    td width="270" bgcolor="#FFFDF0" valign="top"><font class="smalltxt">&nbsp;<a href="mailto:<% =rs.Fields("Email")%>"><% =rs.Fields("Email")%></a></font></td>
                                  </
    tr>                             
                                 
                                
                                 <%                                
                                     
                                 
                                    
    Session ("Email") = rs.Fields("Email")
                                                                        
    iRecordsShown iRecordsShown 1
                                                                    
                                    rs
    .MoveNext
                                                                    
                                    Loop                            
                                
                                end 
    if 
    i need a java script for getting the values of the selected check boxes,can eny one help me on this

  2. #2
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
     <HTML>
     <HEAD>
     <TITLE> New Document </TITLE>
     <META NAME="Generator" CONTENT="EditPlus">
     <META NAME="Author" CONTENT="">
     <META NAME="Keywords" CONTENT="">
     <META NAME="Description" CONTENT="">
     <script>
     function toggleChecks(which, state)
     {
     	var container = document.getElementById(which);
     	var inputs = container.getElementsByTagName('INPUT');
     	for(i = 0; i < inputs.length; i++)
     	{
     		if(inputs[i].type == 'checkbox')
     		{
     			inputs[i].checked = state;
     		}
     	}
     }
     </script>
     </HEAD>
     
     <BODY>
     
     <input type="checkbox" onClick="toggleChecks('test', this.checked);" />
     
     <table id="test">
     	<tr>
     		<td><input type="checkbox" /></td>
     	</tr>
     		<td><input type="text" /></td>
     	</tr>
     		<td><input type="checkbox" /></td>
     	</tr>
     		<td><input type="checkbox" /></td>
     	</tr>
     		<td><input type="checkbox" /></td>
     	</tr>
     		<td><input type="text" /></td>
     	</tr>
     </table>
     </BODY>
     </HTML>



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
  •