I have been trying to implement the following HTML and JavaScript code:
<html>
<textarea id='txt' style='height:500px; widht:400px'></textarea>
<input type='text' id='input'/>
<input type='button' id='clicMe' onkeypress='fillTxt()' />
<script>
function fillTxt(){
if(event.keyCode == 13)
document.getElementById('txt').value += document.getElementById('input').value + <br/>;
}
</script>
</html>
My goal is to click a button and have the text from the input field added to the textarea, vertically aligned at the bottom. In other words, the newly added text should appear at the bottom of the textarea.
For example:
.-----------------------------.
| |
| |
| |
| this is some text |
'-----------------------------'
UPDATE:
I have managed to make it work now with the following code:
<div id="tBox" style="
position:absolute;
top:400px;
left:220px;
width:600px;
height:334px;
color:#666666;
padding:5px;
margin-bottom:25px;">
<div id="tHolder" style="
width:500px;
height:300px;
background-color:transparent;
color:#008080;
font-weight:bold;
border-style:hidden;
left:5px;
background-color:transparent;
position:relative;
overflow:auto;">
<p id="txt" style='position:absolute; bottom:0; left:0;'></p>
</div>
<input type="text" style="width:500px; position:absolute; bottom:15px; left:8px;" id="input" name="input" onkeydown="fillTxt()" />
</div>