Dynamically changing a cell content

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joe Smith

    Dynamically changing a cell content

    Hi, I'm using the code below to change the contents of a cell table in IE.
    The problem is that the cell size won't adjust to the size of the content,
    as its positions have been declared 'absolute'. If I change that to
    relative, the cell is sized to contain all the contents, and not just the
    visible one.

    Is there any solution to this? What I would like is, ideally, that the cell
    size takes the largest width and height it is going to have, or if that's
    not possible, the size of the current contents being shown.

    Thanks!!

    <code>


    <html><head></head>
    <body>
    <script>
    function show(name) {
    document.all[name].style.visibili ty = 'visible';
    }
    function hide(name) {
    document.all[name].style.visibili ty = 'hidden';
    }

    </script>
    <form>
    <input type=button onclick="hide(' table2');show(' table1');" value="Show 1">
    <input type=button onclick="hide(' table1');show(' table2');" value="Show 2">

    </form>

    <table border=3>
    <tr>
    <td>one</td>
    <td>two</td>
    </tr>
    <tr>
    <td>
    AAAAAAAAA
    </td>
    <td>
    <div id=option style='position :relative'>

    <table border=1 id=table1 style='position :absolute; visibility:hidd en'>
    <tr><td>
    BBBB<br>
    CCCC<br>
    DDDD<br>
    </td>
    </tr>
    </table>

    <div id=table2 style='position :absolute; visibility:hidd en'>
    lqdflkjqndflkn
    </div>


    </div>
    </td>
    </tr>
    </table>

    </body></html>


    </code>


  • Csaba2000

    #2
    Re: Dynamically changing a cell content

    I think what you're looking for is .style.display = '' vs. .style.display = ''
    and not .style.visibili ty
    Csaba Gabor from New York

    "Joe Smith" <nospam@nospam. com> wrote in message news:blbh7a$8eo $1@news-reader1.wanadoo .fr...[color=blue]
    > Hi, I'm using the code below to change the contents of a cell table in IE.
    > The problem is that the cell size won't adjust to the size of the content,
    > as its positions have been declared 'absolute'. If I change that to
    > relative, the cell is sized to contain all the contents, and not just the
    > visible one.
    >
    > Is there any solution to this? What I would like is, ideally, that the cell
    > size takes the largest width and height it is going to have, or if that's
    > not possible, the size of the current contents being shown.
    >
    > Thanks!!
    >
    > <code>
    >
    >
    > <html><head></head>
    > <body>
    > <script>
    > function show(name) {
    > document.all[name].style.visibili ty = 'visible';
    > }
    > function hide(name) {
    > document.all[name].style.visibili ty = 'hidden';
    > }
    >
    > </script>
    > <form>
    > <input type=button onclick="hide(' table2');show(' table1');" value="Show 1">
    > <input type=button onclick="hide(' table1');show(' table2');" value="Show 2">
    >
    > </form>
    >
    > <table border=3>
    > <tr>
    > <td>one</td>
    > <td>two</td>
    > </tr>
    > <tr>
    > <td>
    > AAAAAAAAA
    > </td>
    > <td>
    > <div id=option style='position :relative'>
    >
    > <table border=1 id=table1 style='position :absolute; visibility:hidd en'>
    > <tr><td>
    > BBBB<br>
    > CCCC<br>
    > DDDD<br>
    > </td>
    > </tr>
    > </table>
    >
    > <div id=table2 style='position :absolute; visibility:hidd en'>
    > lqdflkjqndflkn
    > </div>
    >
    >
    > </div>
    > </td>
    > </tr>
    > </table>
    >
    > </body></html>
    >
    >
    > </code>
    >
    >[/color]


    Comment

    • Csaba2000

      #3
      Re: Dynamically changing a cell content

      should be vs. .style.display= 'none'

      "Csaba2000" <news@CsabaGabo r.com> wrote in message news:blk2uj$rpg @dispatch.conce ntric.net...[color=blue]
      > I think what you're looking for is .style.display = '' vs. .style.display = ''
      > and not .style.visibili ty
      > Csaba Gabor from New York
      >
      > "Joe Smith" <nospam@nospam. com> wrote in message news:blbh7a$8eo $1@news-reader1.wanadoo .fr...[color=green]
      > > Hi, I'm using the code below to change the contents of a cell table in IE.
      > > The problem is that the cell size won't adjust to the size of the content,
      > > as its positions have been declared 'absolute'. If I change that to
      > > relative, the cell is sized to contain all the contents, and not just the
      > > visible one.
      > >
      > > Is there any solution to this? What I would like is, ideally, that the cell
      > > size takes the largest width and height it is going to have, or if that's
      > > not possible, the size of the current contents being shown.
      > >
      > > Thanks!!
      > >
      > > <code>
      > >
      > >
      > > <html><head></head>
      > > <body>
      > > <script>
      > > function show(name) {
      > > document.all[name].style.visibili ty = 'visible';
      > > }
      > > function hide(name) {
      > > document.all[name].style.visibili ty = 'hidden';
      > > }
      > >
      > > </script>
      > > <form>
      > > <input type=button onclick="hide(' table2');show(' table1');" value="Show 1">
      > > <input type=button onclick="hide(' table1');show(' table2');" value="Show 2">
      > >
      > > </form>
      > >
      > > <table border=3>
      > > <tr>
      > > <td>one</td>
      > > <td>two</td>
      > > </tr>
      > > <tr>
      > > <td>
      > > AAAAAAAAA
      > > </td>
      > > <td>
      > > <div id=option style='position :relative'>
      > >
      > > <table border=1 id=table1 style='position :absolute; visibility:hidd en'>
      > > <tr><td>
      > > BBBB<br>
      > > CCCC<br>
      > > DDDD<br>
      > > </td>
      > > </tr>
      > > </table>
      > >
      > > <div id=table2 style='position :absolute; visibility:hidd en'>
      > > lqdflkjqndflkn
      > > </div>
      > >
      > >
      > > </div>
      > > </td>
      > > </tr>
      > > </table>
      > >
      > > </body></html>
      > >
      > >
      > > </code>
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...