Results 1 to 2 of 2

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

  1. #1
    Member
    Join Date
    Jul 10
    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 04
    Location
    Inside the CPU...
    Posts
    6,482

    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 Blog • 101 LINQ Samples • JSON Validator • XML Schema Validator • "How Do I" videos on MSDN • VB.NET and C# Comparison • Good Coding Practices • VBForums Reputation Saver • String Enum • Super Simple Tetris Game


    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
  •