Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7051203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:14:08+00:00 2026-05-28T03:14:08+00:00

I have three labels having folowing code on all with different ids and three

  • 0

I have three labels having folowing code on all with different ids and three divs 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>&nbsp;

here is div code for all

<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 want to make a show or hide mechanism from label click can anyone tell me how can i do this that when i click a label then the a specific div should show and others should hide and when i click next label the its coresspondent div should show.

UPdate
This is My Script Code

<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 lablel code

<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>&nbsp;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:14:09+00:00Added an answer on May 28, 2026 at 3:14 am

    You can write JavaScript.

    Markup:

    <asp:Label ID="CA" 
                   runat="server"
                   onclick="hideshow(this)"
                   Text="Label">
    </asp:Label>
    <div id="DIV_CA" 
         runat=server 
         align="center"  
         style="background-color:#f3f3f3; text-align:
                left; width: 500px; height: 470px; overflow:auto; display:none;">
             Some data
    </div>
    

    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";
        }
    

    EDIT: To hide all divs and show a specific div.

    Markup: put all <asp:Label/> and <div> inside another <div/>

     <div id="allDiv">
            <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="this.style.cursor='pointer'; "   onclick="hideshow(this)"></asp:Label>
            <asp:Label ID="CB" runat="server"  Font-Bold="False" Font-Names="Arial" Font-Size="10pt" style="padding-top:6px;" ForeColor="#CCCCCC" Height="100%" Text="Current Activities" onmouseover="this.style.cursor='pointer'; "   onclick="hideshow(this)"></asp:Label>
            <div id="DIV_CA" runat="server" align="center"  style="background-color:#f3f3f3; text-align: left; width: 500px; height: 470px; overflow:auto; display:none;">Some data1</div>
            <div id="DIV_CB" runat="server" align="center"  style="background-color:#f3f3f3; text-align: left; width: 500px; height: 470px; overflow:auto; display:none;">Some data2</div>
    </div>
    

    JavaScript: function hideDiv() set display:none to all child div.

    <script type="text/javascript">
        function hideshow(span) {
            hideDiv();
            span.style.fontWeight = "bold";
            var div = document.getElementById("DIV_" + span.id);
            if (div.style.display == "none")
                div.style.display = "block";
            else
                div.style.display = "none"; 
        }
        function hideDiv() {
            var childDiv = document.getElementById("allDiv").childNodes;
            for (i = 0; i < childDiv.length; i++) {
                if (childDiv[i].tagName == "DIV") {
                    childDiv[i].style.display = "none";
                }
                if (childDiv[i].tagName == "SPAN") {
                    childDiv[i].style.fontWeight = "normal";
                }
            }
        }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three TextBox controls on the page <asp:TextBox ID=TextBox1 runat=server AutoPostBack=True OnTextChanged=TextBox_TextChanged TabIndex=1>
I have many labels as children of many different stack panels which are all
I have three button named(titled) hello, nothing, heaven and one label (IBOutlet UIlabel lab).
I have one label field and three buttons with the name of red, yellow,
I have three divs : <div id=login /> <div id=content /> <div id=menu />
I have 2 tables. 1st,cardb ID,car,engine,gear 2nd,labels ID,label,value what i need to do is,
I'm having trouble with my radio buttons. I can click on all three at
I've used the following code in rails 2.3 without having to have a named
Is there any way to have a label wordwrap text as needed? I have
I have three tables: page, attachment, page-attachment I have data like this: page ID

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.