Select All checkbox

    Date: 06/20/05 (Javascript Community)    Keywords: no keywords

    Hello! I'm missing something obvious in the following bit of code...

    Expected Result: Clicking Select All selects all checkboxes on the page
    Actual Result: Clicking Select All only puts a checkbox in the box I checked

    In the header:
    function select_all() {
    for (var i = 0; i < document.formname.elements.length; i++) {
    var elem = document.formname.elements[i];
    if ((elem.name != 'allbox1') && (elem.name != 'allbox2') && (elem.type == 'checkbox')) {
      if (document.formname.allbox1.checked == 'true'
      || document.formname.allbox2.checked == 'true') {
       elem.checked = 'true';
       document.formname.allbox1.checked = 'true';
       document.formname.allbox2.checked = 'true';
    } } }}

    The actual form element:
    Select All
    Select All

    See anything obvious?

    Thanks much!
    -kim.

    Source: http://www.livejournal.com/community/javascript/70339.html

« Using eval(), debugging in... || Javascript »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home