DYnamically setting the vertical alignment for cell/rows

D

dschectman

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
 
W

Will McCutchen

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';
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,054
Latest member
LucyCarper

Latest Threads

Top