
September 24th, 2012, 09:19 PM
|
|
Registered User
|
|
Join Date: Sep 2012
Posts: 2
Time spent in forums: 37 m 52 sec
Reputation Power: 0
|
|
|
1st issue resolved. I now need to know how to removes lines from a textarea with a bu
I have the first part of my script working where I can append new lines to the textarea from a regular input box via button, but I need to be able to remove one or more lines of text from the textarea when selected with a second button.
Can someone help me out with this? I'm sure I'm missing something really simple here.
Here is my code:
[CODE
<!-- This function works //-->
<script language="javascript" type="text/javascript">
function addtext() {
var newtext = document.myform.inputtext.value;
document.myform.outputtext.value += newtext + "\n";
}
<!--This function doesn't work //->
function removeText()
{
var oldtext=document.getElementById("outputtext");
document.myform.outputtext.value.removeChild(textarea.childNodes[0]);
}
</script>
<form name="myform">
<table width="495" border="0" cellpadding="5" cellspacing="0"><tr>
<td width="167" rowspan="2" valign="bottom"><input type=text name="inputtext"></td>
<td width="133" height="63" valign="middle"></p>
<input type="button" value="Add Category" onClick="addtext();"></td>
<td width="165" rowspan="2"><textarea name="outputtext" rows="6"></textarea></td>
</tr>
<tr>
<td valign="top"><input type="button" name="Reset" id="Reset" value="Reset Categories" onClick="removetext();"></td>
</tr>[/CODE]
|