• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

JavaScript / HTML Cell Height Question

hoihtah

Diamond Member
i'm having a cell height problem.
not being fluent in javascript, it's been a frustrating experience.
i'd appreciate any input you gurus might have.

so i have a table with 4 cells.

------
|`|B|
|A|-|
|`|C|
------
| D |
------

cell A will grow in height.
- it's an include from database... so the lengths can grow and shrink depending on what's in the database.
cell B needs to have fixed height
cell C needs to have variable height. A-B

How do i set this up?
 
so far i have this... and it's not working. 🙁

<html>
<body onResize=location.reload();>
<table border=1>
<tr>
<td id="cellA" rowspan=2>
some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text some Text
</td>
<td id="cellB" height="20">
B
</td>
</tr>
<tr>
<td id="cellC" onLoad="this.height=document.all.cellA.clientHeight-20;">
C
</td>
</tr>
<tr>
<td id="cellD" colspan=2>
D
</td>
</tr>
</table>
</body>
</html>
 
Originally posted by: pmark
I don't understand what you are trying to do. Why do you have to use Javascript for this?

i'd be happy to find ways to do this without using javascript.
but i don't think html alone will do the job... at least i can't seem to, anyway.

and you are correct, you can't use onLoad on TD.
so i'd have to use 1 pix wide invisible gif to extend TD.

but i still can't get this to work in NS. 🙁
 
No need to use javascript. Try CSS instead.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Template</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<style type="text/css"><!--
table, td { border: thin solid black; }
#A { width: 50%; }
#B { height: 60px; }
--></style>
</head>
<body>
<table>
<tr>
<td id="A" rowspan="2"></td>
<td id="B"></td>
</tr>
<tr>
<td id="C"></td>
</tr>
</table>
</body>
</html>

Hope this works for you. Don't forget to validate...
 
Back
Top