Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-31-2008, 10:24 PM   PM User | #1
hedidit
New to the CF scene

 
Join Date: Jul 2008
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
hedidit is an unknown quantity at this point
set row height

Hello, I am wondering why I cannot set my row heights via jscript. The situation is that I have 2 tables that sit side by side. I cannot combine them, or I would have done that long ago So, I am trying to implement a javascript solution. I want the row heights to adjust to line up when a row is put into edit mode and I want the header rows to match up. the header row on the second table gridHCSprea is much taller. Can someone please poitn me in the right direction as to why this is not working? TIA

Code:
function setHCGrids(){
				var x=document.getElementById('gridHCPosition').rows;
				var y=document.getElementById('gridHCSpread').rows;
				x[0].height = y[0].height;
				for (i=1; i<x.length; i++)
				{
					x[i].height = y[i].height;
				}

            }

Last edited by hedidit; 07-31-2008 at 10:27 PM..
hedidit is offline   Reply With Quote
Old 08-01-2008, 09:17 AM   PM User | #2
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
Maybe:
Code:
var x=document.getElementById('gridHCPosition').getElementsByTagName('tr');
var y=document.getElementById('gridHCSpread').getElementsByTagName('tr');
for(var i=0;i<x.length;i++){
x[i].style.height=y[i].offsetHeight+'px'
}
But you should know that a row takes anyway the height of its higher cell, if the cell has set a height (or the text inside the cell overpasses the tr height)
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Users who have thanked Kor for this post:
hedidit (08-01-2008)
Old 08-01-2008, 01:55 PM   PM User | #3
hedidit
New to the CF scene

 
Join Date: Jul 2008
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
hedidit is an unknown quantity at this point
Quote:
Originally Posted by Kor View Post
Maybe:
Code:
var x=document.getElementById('gridHCPosition').getElementsByTagName('tr');
var y=document.getElementById('gridHCSpread').getElementsByTagName('tr');
for(var i=0;i<x.length;i++){
x[i].style.height=y[i].offsetHeight+'px'
}
But you should know that a row takes anyway the height of its higher cell, if the cell has set a height (or the text inside the cell overpasses the tr height)
Thank you so much. I am making the transition from desktop to web dev and I am having a time with Jscript. Again, thanks for your help.
hedidit is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 02:57 PM.


Advertisement
Log in to turn off these ads.