SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    183
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    To check the child checkboxes.

    Can I get the Javacript code for checking all the Child checkboxes, on clicking the Master check box.(Just like hotmail does) The child checkboxes are generated with stylesheet code and its not HTML.

    This is the stylesheet code (in an .asp page) to generate the child checkboxes.

    Following is the stylesheet in an .asp page

    Code:
    <XML id='listXSL'>
       <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
         <xsl:template match="/">
    	<table width="100%">
    
              <xsl:for-each select="/itemlist/item">
                <tr>
    	      <td width="40" class="fmText4"><input type="checkbox" name="chkChild" value="chkChild"><xsl:attribute 
    
    name="name">chk<xsl:value-of select='id'/></xsl:attribute></input></td>
    							
                </tr>
             </xsl:for-each>
            </table>
          </xsl:template>
       </xsl:stylesheet>
    </XML>

  2. #2
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    183
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This works


    Code:
    Code:
    // get all inputs in document - replace document with the proper parent element
    var inputs = document.getElementsByTagName('input');
    for (var i = 0; i < inputs.length; i++) {
      if (inputs[i].getAttribute('type') == 'checkbox') {
        inputs[i].setAttribute('checked', 'checked');
      }
    }

  3. #3
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That will check every checkbox on the page, is that what you want?

    What about unchecking them all?


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
  •