Hiding / Showing a Table with JavaScript
<p>hi i have atable with some data and i have expand and Collapse button there if we click on + it will expand and show table and if we click on-it will collapse and i am using following code but i am getting error with </p>

<pre><code>document.getElementById('eleName');

imageXchk='expand';  
loadedCheck='false';
function toggleDisplayCheck(e, tableSize){

element = document.getElementById(e).style;
 if (element.display=='none') {
    element.display='block';
    }
 else {
    element.display='none';
    }

 if (loadedCheck=='false') {
    myUpdater('returnsDetailsTable', '/oasis/faces/merchant/dashboard/ReturnsDetailsCheck.jsp', { method: 'get' }); 
    loadedCheck='true'
    }

    size = tableSize-1;
    eleName = 'mercPerfDashboardForm:returnsDetailsTable:' + size +':switchimageRetChk'
 if (imageXchk=='collapse') {
    document.getElementById('eleName').src='${pageContext.request.contextPath}/images/expand.gif';imageXchk='expand';
    }
  else {
    document.getElementById('eleName').src='${pageContext.request.contextPath}/images/collapse.gif';imageXchk='collapse';
    }   
    return false;
}
</code></pre>
