How to checkall only filtered items in the list
<p>I have a Search Filter for Check box List using Jquery and java Script....Also i have Checkall and UncheckAll radio buttons..If i enable CheckAll button...it will check all checkboxes in that list...If i filter the list using search filter, also it will check all checkboxes in that list...</p>

<p>Now i want to check only filtered items in the list should checked, if i click checkall....
If i not filter means it will check all items in the list...</p>

<p>My codings are below...</p>

<p><strong>CheckAll coding:</strong></p>

<pre><code>&lt;script&gt;
function checkall(formname,checkname,thestate)
     {
            var el_collection=eval("document.forms."+formname+"."+checkname);
            for (c=0;c&lt;el_collection.length;c++)
                el_collection[c].checked=thestate
     }
&lt;/script&gt;
</code></pre>

<p><strong>Search Filter Coding:</strong></p>

<pre><code>    &lt;script&gt;
    (function ($) {
      jQuery.expr[':'].Contains = function(a,i,m){
          return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase())&gt;=0;
      };

      function listFilter(header, list) {
        var form = $("&lt;form&gt;").attr({"class":"filterform","action":"#"}),
            input = $("&lt;input&gt;").attr({"class":"filterinput","type":"text"});
        $(form).append(input).appendTo(header);

        $(input)
          .change( function () {
            var filter = $(this).val();
            if(filter) {

              $(list).find("a:not(:Contains(" + filter + "))").parent().slideUp();
              $(list).find("a:Contains(" + filter + ")").parent().slideDown();
            } else {

              $(list).find("li").slideDown();
            }
            return false;
          })
        .keyup( function () {
            $(this).change();
        });
      }

      $(function () {
        listFilter($("#header"), $("#list"));
        listFilter($("#header1"), $("#list1"));
      });
    }(jQuery));
&lt;/script&gt; 


&lt;script type="text/javascript"&gt;
function show()
{

 if (window.XMLHttpRequest)
    {
        xmlhttp=new XMLHttpRequest();
    }
    else
    {
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.open("GET","location.xml",false);
    xmlhttp.send();
    xmlDoc=xmlhttp.responseXML;
    var x=xmlDoc.getElementsByTagName("value");

    for (i=0;i&lt;x.length;i++)
    {
     var name=x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue;
     var link = document.createElement( "a" );
     var list = document.createElement( "li" );
     var cb = document.createElement( "input" );
     cb.type = "checkbox";
     cb.id = "c1";
     cb.value = name;
     cb.name="v1";
     cb.checked = false;

     link.appendChild(cb);
     link.innerHTML+=name;

     var lists=document.getElementById('list');
     list.appendChild(link);
     lists.appendChild(list);

     }
}
&lt;/script&gt;
</code></pre>

<p><strong>My body Tag codings:</strong></p>

<pre><code>&lt;form id="tracklocation"&gt;
    &lt;ul id="list" style="list-style:none"&gt;
    &lt;/ul&gt;

     &lt;h1 id="header1"&gt;DVD Collection&lt;/h1&gt;

    &lt;input type="radio" value="ca" name="dt" onclick="checkall('tracklocation','v1',true)"&gt;Check All&amp;nbsp;&amp;nbsp;&lt;input type="radio" value="ua" name="dt" onclick="checkall('tracklocation','v1',false)"&gt;Uncheck All
  &lt;/form&gt;
</code></pre>

<p>How to checkall only filtered items in the list..please help me....</p>
