DYnamically setting the vertical alignment for cell/rows

Discussion in 'Javascript' started by dschectman@yahoo.com, Oct 31, 2005.

  1. Guest

    I have an application that uses javascript to dynamically create
    tables.

    var selectedGridTab = document.getElementById(myTableName);
    ....
    var row = selectedGridTab.insertRow(rowid);
    //row.setAttribute("valign","middle");
    row.vAlign = 'middle';
    .....
    var cell = row.insertCell(i);
    //cell.setAttribute("valign","middle");
    cell.vAlign = 'middle';
    cell.innerHTML = val;

    This code works for IE 5.5. The text of the cells in the tables in
    vertically centered. The code does not work for IE 6.0. No matter
    whether I use setAttribute or .vAlign, the text always displays
    vertically at the top of the cell.

    I have not tested more recent versions of IE.

    Thanks in advance,

    David
    , Oct 31, 2005
    #1
    1. Advertising

  2. wrote:
    > I have an application that uses javascript to dynamically create
    > tables.
    > ...
    > cell.vAlign = 'middle';
    > ...
    > This code works for IE 5.5. The text of the cells in the tables in
    > vertically centered. The code does not work for IE 6.0. No matter
    > whether I use setAttribute or .vAlign, the text always displays
    > vertically at the top of the cell.


    Try setting the CSS property like so:

    cell.style.verticalAlign = 'middle';
    Will McCutchen, Oct 31, 2005
    #2
    1. Advertising

  3. Guest

    Thanks, that worked.

    Will McCutchen wrote:
    > wrote:
    > > I have an application that uses javascript to dynamically create
    > > tables.
    > > ...
    > > cell.vAlign = 'middle';
    > > ...
    > > This code works for IE 5.5. The text of the cells in the tables in
    > > vertically centered. The code does not work for IE 6.0. No matter
    > > whether I use setAttribute or .vAlign, the text always displays
    > > vertically at the top of the cell.

    >
    > Try setting the CSS property like so:
    >
    > cell.style.verticalAlign = 'middle';
    , Nov 7, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dba56
    Replies:
    0
    Views:
    829
    dba56
    Apr 14, 2005
  2. Luc
    Replies:
    2
    Views:
    408
    Sid Ismail
    Jan 19, 2004
  3. Nik Coughin

    Vertical alignment in a div

    Nik Coughin, Jan 21, 2004, in forum: HTML
    Replies:
    9
    Views:
    5,321
    Nik Coughin
    Jan 28, 2004
  4. Jim Heavey

    Vertical Alignment

    Jim Heavey, Mar 2, 2004, in forum: HTML
    Replies:
    10
    Views:
    769
  5. Arondelle
    Replies:
    12
    Views:
    766
    Spartanicus
    Jul 18, 2004
Loading...

Share This Page