CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2006
    Posts
    170

    [RESOLVED] a beginner

    How do I do if I want a javascript that makes a lable visible or not depending on if a checkbox is clicked or not? I'm writing in c# and asp.net

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: a beginner

    You have to change the elements style.

    Code:
    <img src="path/to/image.jpg" id="theimg" style="display: none;">
    <input type="button" value="Change" onclick="hideshow()">
    
    <script language="JavaScript">
    function hideshow(){
      var obj = document.getElementById('theimg');
      if(obj.style.display == "none"){obj.style.display = "block";}
      else{obj.style.display = "none";}
    }
    </script>
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3

    Re: a beginner

    And you won't need any server side programming to achieve it as shown on the example from PeejAvery.
    David Domingues at [email protected]. Feel free to visit http://www.webrickco.com

  4. #4
    Join Date
    May 2006
    Posts
    170

    Talking Re: a beginner

    Thanks I'll try it out today =). If I have anymore questions I'll be back!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured