PDA

View Full Version : Javascript Code Required for calculating height....



dchopda
07-06-2009, 05:33 AM
Hi,

I am working on outlet pages of an online store.
There are 4 products displayed on each row.
On that store, products are displayed with images,product name, model no., price and buttons.
For some products, the name is longer, for some price is longer.
I am using <td> for displaying each information.

The problem is - the height of the name's <td> and price's <td> are different for different products.

I want a JS code which can detect the biggest height (for each row separately) from both the above td's separately and assign the maximum height to the corresponding 3 td's of that row.

This should be done for each row separately.

note : I an right now using this code - But it takes the height of both td's for 1st product only and assign it to all the products.

<script type="text/javascript" language="javascript">

var ht1 = document.getElementById("name_td1").offsetHeight;
document.getElementById("name_td1").style.height = ht1;

var ht2 = document.getElementById("price_td2").offsetHeight;
document.getElementById("price_td2").style.height = ht2;

</script>


Can someone help me ??????????????

Thanks..