Friday, July 27, 2012

collapse div


This is the javascript part:

<script language="JavaScript" type="text/JavaScript">

function collapse(collapsId, expandId) {
document.getElementById(collapsId).style.display = "none";
document.getElementById(expandId).style.display = "block";
}
function expand(collapsId, expandId) {
document.getElementById(collapsId).style.display = "block";
document.getElementById(expandId).style.display = "none";
}


</script>


------------------------------


jsp/html page :



<div id="divE" style="display: none;">
 <s:a href="javaScript:expand(' divA',' divE')">
 <img id="iviFormCoImg" src="Images/Expand.png" alt="Expand" />Expand</s:a>
</div>

<div  class="pageContainer" id="divA"  style="position: relative;">


<div id="divC" style="display: block;">
<a href="javaScript:collapse(' divA ',' divE')">
        <img src="Images/Collapse.png" alt="Collapse" />Collapse</a>
</div>

</div>


No comments:

Post a Comment