Results 1 to 2 of 2

Thread: How to make it only visible not hide the contents?

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2010
    Posts
    38

    How to make it only visible not hide the contents?

    I want the contents to be visible once clicked but this script hide it on second click too..


    Code:
    <!--
        function toggle_visibility(id) {
           var e = document.getElementById(id);
           if(e.style.display == 'block')
              e.style.display = 'none';
           else
              e.style.display = 'block';
        }
    //-->


    Code:
    <li><a href="#" onclick="toggle_visibility('Websites'); ">Websites</a></li>

    Code:
    <div id="Websites">
    	
    <-----------  CONTENTS INSIDE-------------->
    	
    	</div>

    So i want to make it only show when i click on the nav menu known as "Websites".But it hides on 2nd click.
    Please help me..


    Thank you
    If i helped you on solving your problem then please rate my post.

    Also call me Champ as i like that name (Read this : http://www.vbforums.com/showthread.php?t=638763 )

  2. #2
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: How to make it only visible not hide the contents?

    You want to let it remain visible once it is visible?
    Code:
    <!--
        function toggle_visibility(id) {
           var e = document.getElementById(id);
           e.style.display = 'block';
        }
    //-->
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

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