Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > DYnamically setting the vertical alignment for cell/rows

Reply
Thread Tools

DYnamically setting the vertical alignment for cell/rows

 
 
dschectman@yahoo.com
Guest
Posts: n/a
 
      10-31-2005
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

 
Reply With Quote
 
 
 
 
Will McCutchen
Guest
Posts: n/a
 
      10-31-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) 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';

 
Reply With Quote
 
 
 
 
dschectman@yahoo.com
Guest
Posts: n/a
 
      11-07-2005
Thanks, that worked.

Will McCutchen wrote:
> (E-Mail Removed) 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';


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Vertical alignment of textbox in edititemtemplate dba56 ASP .Net 0 04-14-2005 07:22 PM
Vertical Alignment Gone Wrong, One More Time Arondelle HTML 12 07-18-2004 07:54 AM
Vertical Alignment Jim Heavey HTML 10 03-03-2004 09:30 AM
Vertical alignment in a div Nik Coughin HTML 9 01-28-2004 10:08 PM
vertical alignment of the cell's contents ?? Luc HTML 2 01-19-2004 12:59 AM



Advertisments