...

View Full Version : set row height



hedidit
07-31-2008, 11:24 PM
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 :D 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



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

}

Kor
08-01-2008, 10:17 AM
Maybe:


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)

hedidit
08-01-2008, 02:55 PM
Maybe:


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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum