Connecting Tech Pros Worldwide Forums | Help | Site Map

DYnamically setting the vertical alignment for cell/rows

dschectman@yahoo.com
Guest
 
Posts: n/a
#1: Oct 31 '05
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


Will McCutchen
Guest
 
Posts: n/a
#2: Oct 31 '05

re: DYnamically setting the vertical alignment for cell/rows


dschectman@yahoo.com wrote:[color=blue]
> 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.[/color]

Try setting the CSS property like so:

cell.style.verticalAlign = 'middle';

dschectman@yahoo.com
Guest
 
Posts: n/a
#3: Nov 7 '05

re: DYnamically setting the vertical alignment for cell/rows


Thanks, that worked.

Will McCutchen wrote:[color=blue]
> dschectman@yahoo.com wrote:[color=green]
> > 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.[/color]
>
> Try setting the CSS property like so:
>
> cell.style.verticalAlign = 'middle';[/color]

Closed Thread