1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Hide/Unhide tables in pages

Discussion in 'Software Development' started by ksuwyldkat, May 19, 2003.

Thread Status:
Not open for further replies.
Advertisement
  1. ksuwyldkat

    ksuwyldkat Thread Starter

    Joined:
    Nov 9, 2000
    Messages:
    341
    I have two issues that I am banging my head over.

    1) I have a page with 4 tables. The top 2 tables each have a link that when clicked will bring up one of the bottom two tables. I have this working now where the bottom tables are hidden until the link is clicked then becomes visible.

    The problem is the space is still being taken up by the other hidden table. So if I click the second link, there is this huge gap and then the other table is visible. Any idea on how to not have the gap? I tried using "document.write" but the way I wrote it screwed up the layout.


    2) Problem two is similar. I have a form select, that when option 2 is selected I would like to make a table visible. I tried using the same code as the one above with an anchor tag on the second select but it did not work. I then changed it to onSelect and still nothing. Any ideas on how to make a selection make a table visible?

    Thanks in advance.
     
  2. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    Why not make a seperate page...seems a lot easier than hiding and unhiding tables. you can do it with active scripting and probably even Java.
     
  3. brendandonhu

    brendandonhu

    Joined:
    Jul 8, 2002
    Messages:
    14,681
    You should probably just use two pages...
    or put the first table within a DIV, something like this.

    PHP:
    <div id="myDiv" style="visibility:hidden">
    <
    code for the table hoes here>
    blah blah blah
    </div>
    Then, clicking this link will show the hidden table.

    PHP:
    <a href="#" onclick="myDiv.style.visibility=visible">Show Table</a>
     
  4. deuce868

    deuce868

    Joined:
    Nov 2, 2000
    Messages:
    637
    if you have a server side language available you could pass a variable in the url and check it to see if the tables should be shown or not. Then print out the content based on those values.
     
  5. ksuwyldkat

    ksuwyldkat Thread Starter

    Joined:
    Nov 9, 2000
    Messages:
    341
    I have the div tag like what brendandonhu suggested. This is what causes the blank spaces since the tables are still there just hidden.

    I think the seperated pages is the best way to do it. Again I was making it more difficult than it had to be.

    Thanks for the help.
     
  6. brendandonhu

    brendandonhu

    Joined:
    Jul 8, 2002
    Messages:
    14,681
    Or, you could do what deuce said, but in Javascript using Query Strings, something like

    if the url is
    http://mypage.com/mypage.html?showtable=yes
    then embed showtable.js
    which would add the table to the page. something like that.
     
  7. ksuwyldkat

    ksuwyldkat Thread Starter

    Joined:
    Nov 9, 2000
    Messages:
    341
    I have the first problem solved. But I still have the second issue that won't work.

    I have a select form with two options. If I choose the second option I have a table that I want displayed. If I use the onSelect event but it won't change the style.visibility = "visible". Right now I have the span tag set to style.visibility = "hidden".

    Any ideas on using a select form to do this?
     
  8. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/134552

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice