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 183221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:04:38+00:00 2026-05-11T15:04:38+00:00

I have a web application(ASP.NET2.0 C#). Within it, I have a div that contains

  • 0

I have a web application(ASP.NET2.0 C#). Within it, I have a div that contains a checkbox list and a button.

I want to toggle the div viewing, so I got some javascript code online to help me.

Heres the code:

<script language='javascript'> var state = 'hidden';  function showhide(layer_ref) {      if (state == 'visible')      {         state = 'hidden';     }     else      {         state = 'visible';     }     if (document.all)      { //IS IE 4 or 5 (or 6 beta)         eval( 'document.all.' + layer_ref + '.style.visibility = state');     }     if (document.layers)      { //IS NETSCAPE 4 or below         document.layers[layer_ref].visibility = state;     }     if (document.getElementById && !document.all)      {         maxwell_smart = document.getElementById(layer_ref);         maxwell_smart.style.visibility = state;     } } </script> 

I call the function this way:

<a href='javascript://' onclick='showhide('AlertDiv');'>Choose Columns</a> 

When I use this function, it shows me the div with the button, but it doesn’t show me the checkboxlist….Any ideas on what’s going on?

Thank you.

  • 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. 2026-05-11T15:04:39+00:00Added an answer on May 11, 2026 at 3:04 pm

    Have you tried using display instead of visiblity?

    For example, instead of:

    document.getElementById(layer_ref).style.visiblity = 'hidden'; document.getElementById(layer_ref).style.visiblity = 'visible'; 

    Use:

    document.getElementById(layer_ref).style.display = 'none'; document.getElementById(layer_ref).style.display = 'block'; 

    You will have to replace all your references to visiblity with display not just the getElementById version. You also may want to look into using jQuery which will handle your scenario with a few lines of code, plus no need for an onclick attribute to cloud you html.

    <script type='text/javascript' src='jquery-1.3.2.js'> </script> <script type='text/javascript'>   $(document).ready(function() {     $('.toggleLink').click(function(e) {        e.preventDefault();        $('#AlertDiv').toggle();     });   }); </script> <a href='#' class='toggleLink'>Choose Columns</a> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application using ASP.NET 2.0 and I want to know if
I have a web application developed with ASP.net and C# that is running on
We have created a web application, using ASP.NET, that allows users to upload documents
A have ASP.NET 2.0 web application that should allow sending emails. I have a
I have created a Web Application in asp.net 2.0. which is working fine on
We have a ASP.Net 2.0 web application up and running with the server in
I have a web application (asp.net) where work items are submitted and allocated to
I have a asp.net web application which has a number of versions deployed on
I have an ASP.NET web application which does the following: Reads an Excel file.
We have an intranet asp.net web application which uses the OOTB ASP.net membership and

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.