473,326 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

DYnamically setting the vertical alignment for cell/rows

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 '05 #1
2 6017
ds********@yahoo.com 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';

Oct 31 '05 #2
Thanks, that worked.

Will McCutchen wrote:
ds********@yahoo.com 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 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: abracad | last post by:
Hi Is it possible to vertically align an image in the middle of a DIV of fixed height?
1
by: Kenneth | last post by:
Okay, I've been scouring Google for hours looking for a solution to this problem, but as of yet I can't find one. XHTML Transitional seems to specify that I can no longer set a table's height to...
3
by: harry | last post by:
I want to be able to change the text alignment within a table cell between "right" & "center" depending on how many rows are in the table. Is this possible in Javascript? - can't see how to do...
7
by: Just Dummy | last post by:
Hi all, I am struggling with a problem for a long time. Problem statement: I have a table and the table can contain n number of rows. i.e., the table rows will be generataed out of a xml...
3
by: WB | last post by:
Hi, I have a RadioButtonList that display a table of my products like so: <asp:RadioButtonList ID="RblProducts" runat="server" CssClass="text" RepeatColumns="4" RepeatDirection="Horizontal" />...
6
by: Andy Mabbett | last post by:
Please can someone remind me of the most elegant fix for the way Firefox fails to vertically align cell content by default? For example, the second event on: ...
2
by: jmarendo | last post by:
Hello, After reading through the "Table Basics - DOM - Refer to table cells" example at mredkj.com , I modified the code for my own purposes. In the modified version, I create a hyperlink and...
2
by: esteuart | last post by:
I need to get the right combination for a div to clip any text inside and allow vertical alignment. I only have this problem in FireFox. I have 3 divs nested within each other. The outer div has...
1
by: hello2008 | last post by:
Hi, I have just started coding in PHP. I have coded a web page using HTML, JS, and PHP. An HTML table has to be populated dynamically using the data from the backend. Presently I have 5...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.