[SalesForce] Rerendering a table row for each selected javascript checkbox

I am trying to display an empty table row (for Object2__c) each time I select a row (for Object1__c) using a javascript checkbox. There's no error but nothing happens every time I tick a checkbox from Object1__c table.

By the way, here's what I've been working so far:

Visualforce Page: CheckVFPage

<apex:page standardController="Object1__c">

    <script type="text/javascript">
        function selectAllCheckboxes(obj,receivedInputID) {
            var inputCheckbox = document.getElementsByTagName("input");
            for(var i=0; i<inputCheckbox.length; i++) {
                if(inputCheckbox[i].id.indexOf(receivedInputID)!=-1) {
                    inputCheckbox[i].checked = obj.checked;
                }
            }
        }
    </script>  

    <apex:pageBlock id="blk1" rendered="{!Showblk1}">
        <apex:pageBlockTable value="{!obj1List}" var="o1">
            <apex:column>
            <apex:facet name="header">
                <apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId2')"/>
            </apex:facet>   
            <apex:inputCheckbox value="{!o1.IsSelected}" id="inputId2">
                <apex:actionSupport event="onclick" reRender="blk2"/>
            </apex:inputCheckbox> 
            </apex:column> 
            <apex:column headerValue="Field1">
                <apex:inputField value="{!o1.Field1__c}"/>
            </apex:column>   
            <apex:column headerValue="Field2">
                <apex:inputField value="{!o1.Field2__c}"/>
            </apex:column>   
        </apex:pageBlockTable>    
    </apex:pageBlock>  

    <apex:pageBlock id="blk2" rendered="{!Showblk2}">
        <apex:pageBlockTable value="{!obj2List}" var="o2">
            <apex:column headerValue="New Field 1">
                <apex:inputField value="{!o2.nf1__c}"/>
            </apex:column>   
            <apex:column headerValue="New Field 2">
                <apex:inputField value="{!o2.nf2__c}"/>
            </apex:column>  
        </apex:pageBlockTable> 
    </apex:pageBlock>

</apex:page>

Best Answer

Setting a checkbox value doesn't invoke onclick. You have to actually "click":

inputCheckbox[i].click();

Keep in mind that calling click in a loop may cause undesirable side effects on the view state.