Results 1 to 4 of 4

Thread: Multiple table rows to hide

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    Brossard, Québec, Canada
    Posts
    241

    Question Multiple table rows to hide

    Hi!

    I have this HTML table in which I have rows displaying each a TEXTBOX and a SELECTBOX. I want to delete a row on the click of a button. I do this with the style.display="none" property and it works except that the SELECTBOX does not get hidden. It look as though it's a screen refresh problem but am not sure. Has anyone gotten this problem before ? How did you fix it?

    Thanks

  2. #2
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602
    For what element are you setting display = 'none'?

    The code below works fine for me...


    <html>
    <head>
    <title></title>
    </head>
    <body>
    <form>
    <table>
    <tr ID = "row1">
    <td><select><option>One</option><option>Two</option></select></td>
    </tr>
    <tr>
    <td><input TYPE = "button" VALUE = "hide row" ONCLICK = "row1.style.display = 'none';"></td>
    </tr>
    </table>
    </form>
    </body>
    </html>


    Chris
    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    Brossard, Québec, Canada
    Posts
    241

    I also have text box in each row

    <html>
    <head>
    <title></title>
    </head>
    <body>
    <form>
    <table>
    <tr ID = "row1">
    <td><input type=text name="amount"> GL No:<select><option>One</option><option>Two</option></select></td>
    </tr>
    <tr>
    <td><input TYPE = "button" VALUE = "hide row" ONCLICK = "row1.style.display = 'none';"></td>
    </tr>
    </table>
    </form>
    </body>
    </html>

    ... is what I have in more than one row and I set the display none for the TR (Table row) but the <select> does not hide... I have to create a function and hide both the Table row AND the <select> but that gives me other problems:
    when I want to display them back (display="block") then it displays on two lines but it was originaly on only one line... weird stuff ?!?

  4. #4
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602
    David,

    I altered it a bit and this still works for me:

    <html>
    <head>
    <title></title>
    </head>
    <body>
    <form>
    <table>
    <tr ID = "row1">
    <td><input TYPE = "text"></td>
    <td><select><option>One</option><option>Two</option></select></td>
    </tr>
    <tr>
    <td><input TYPE = "button" VALUE = "Hide Row" ONCLICK = "row1.style.display = 'none';"></td>
    <td><input TYPE = "button" VALUE = "Show Row" ONCLICK = "row1.style.display='';"></td>
    </tr>
    </table>
    </form>
    </body>
    </html>

    The select element hides and shows as it's supposed to. Instead of using "block" try using '' (two single ticks).

    Chris
    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

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