Forum Moderators: not2easy

Message Too Old, No Replies

textarea with full height below another area

         

ak3dnpq8

7:43 pm on Feb 3, 2007 (gmt 0)

10+ Year Member



I want to do:

<body>
<p>hello world</p>
<textarea style="width:100%; height:(100% - [height of above paragraph])"></textarea>
</body>

How should I do that?

[edited by: SuzyUK at 8:59 pm (utc) on Feb. 3, 2007]
[edit reason] disabled the smiley [/edit]

ericjust

11:01 am on Feb 8, 2007 (gmt 0)

10+ Year Member



You could use a little bit of JavaScript do it (see example below). You could put the getHeight function in your <head> and write a new function (like getTextareaHeights();) which would set up all the heights onload.

Hope this helps! :-)


<script language="javascript">
<!--
function getHeight(element) {
var el = document.getElementById(element);
return el.offsetHeight;
}
//-->
</script>

<p id="paragraph_1">
Hello World. <br />
Hi. <br />
How are you? <br />
Fine. You? <br />
Good. Good. <br />
Cool, well... <br />
Yeah. I better get going. <br />
Me too. <br />
OK, bye. <br />
Bye
</p>

<textarea id="textarea_1" style="width:100%;"></textarea>

<script language="javascript">
<!--
document.getElementById('textarea_1').style.height = getHeight('paragraph_1') + 'px';
//-->
</script>