SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    May 2004
    Location
    USA
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    hide table until certain link is clicked

    First off, let me preface this by saying Ive hardly done any javascript before but Im well versed in php.


    How do I hide a table (and its contents) until a certain link is clicked?


    Im sure the link would have to call the function with its onclick tag, but how would I go about doing this?

    Thanks,
    gex6

  2. #2
    SitePoint Member
    Join Date
    May 2004
    Location
    USA
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, so just after posting this, I finally found something searching in google.

    Code:
     <html>
     <head> 
     <script> 
     function toggle() { 
     	if( document.getElementById("hidethis").style.display=='none' ) { 
     		document.getElementById("hidethis").style.display = ''; 
     	} else { 
     		document.getElementById("hidethis").style.display = 'none'; 
     	} 
     } 
     </script> 
     </head> 
     <body> 
     <a href="#" onClick="toggle();">toggle</a>
     <br /><br />
     <table border="1" id="hidethis">
     <tr><td>Always visible</td></tr>
     <tr><td>Hide this</td></tr>
     <tr><td>Always visible</td></tr></table>
     </body>
     </html>
    Ive tested it and it seems to work just fine


Bookmarks

Posting Permissions

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