multiple checkbox can't access from javascript function
<p>I have dynamic multiple check boxes which is used to restore multiple files.it works perfectly when I have more than 1 check boxes.here is my php code for check boxes:</p>

<pre><code>&lt;form name="RestoreFile"&gt;
    &lt;input type="checkbox" title="'.$FldDoc['FldDocumentName'].'" name="restore_checkbox" value="'.$FldDoc['FldDocumentID'].'" id="restore_'.$NodeId.'_'.$FldDoc['FldDocumentID'].'"/&gt;
    &lt;input type="button" value="Restore" onclick="RestoreDocFile(\''.$NodeId.'\',this.form.restore_checkbox);" /&gt;
&lt;/form&gt;
</code></pre>

<p>And the definition of function RestoreDocFile() is given below: </p>

<pre><code>function getSelected(opt) 
{
    var selected = new Array();
    var index = 0;
    for (var intLoop = 0; intLoop &lt; opt.length; intLoop++) {
       if (opt[intLoop].checked) 
       {
          index = selected.length;
          selected[index] = new Object;
          selected[index].value = opt[intLoop].value;
          selected[index].index = intLoop;
       }
    }
    return selected;
}

function RestoreDocFile(nodeid, opt)
{   
    var getSelectDocIds = getSelected(opt);
//alert(nodeid+','+getSelectDocIds);    
        var strSelectedDocIds = "";
        var i=0;
        for (var item in getSelectDocIds)
        {
           if(i!=0)
           {
                strSelectedDocIds+=":";
           }    
           strSelectedDocIds += getSelectDocIds[item].value ;
           i++;
        }
}
</code></pre>

<p>the problem is that if there has 1 checkbox at the time of form load it doesn't work properly.Anybody can help me out from this problem..Its very Urgent..Thanks in advance..</p>
