I am working with three unique labels, each with different ids and three distinct divs also with different ids.
<asp:Label ID="CA" runat="server" Font-Bold="False" Font-Names="Arial" Font-Size="10pt" style="padding-top:6px;" ForeColor="#CCCCCC" Height="100%" Text="Current Activities" onmouseover="var b = ChangeColorCA(); this.style.cursor='pointer'; return b" onmouseout="RemoveColorCA()"></asp:Label>
Here is the respective div code for each label:
<div id="DIV_CA" runat=server align="center" visible="false" style="background-color:#f3f3f3; text-align: left; width: 500px; height: 470px; overflow:auto;">Some data</div>
I am looking to create a toggle function where clicking on a label will show its corresponding div while hiding the others. I am wondering if anyone can guide me on how to achieve this.
Update: Below is the script code I have been working with:
<script type="text/javascript">
function hideshow(span) {
var div = document.getElementById("DIV_" + span.id);
if (div.style.display == "none")
div.style.display = "block";
else
div.style.display = "none";
}
</script>
And here is the updated label code I am using:
<asp:Label ID="CA" runat="server" Font-Bold="False" Font-Names="Arial" Font-Size="10pt" style="padding-top:6px;" ForeColor="#CCCCCC" Height="100%" Text="Current Activities" onmouseover="var b = ChangeColorCA(); this.style.cursor='pointer'; return b" onmouseout="RemoveColorCA()" onclick="hideshow(this)" ></asp:Label>