Hi, Im new to here.
I have a problem with some JS for my website.
I made JS to enter text from input boxes in form to a read only text area. However it overites the text instead of putting it below (thats what I want it to do, put it below previous after clicking the add button). I tried few things that didn't work so I erased it from the code. Maybe one og you will know.
HTML code:
<tr>
<td>
Kod Produktu:
</td>
<td>
<input type="text" id="ip1" />
</td>
</tr>
<tr>
<td>
Opis:
</td>
<td>
<input type="text" id="ip2" />
</td>
</tr>
<tr>
<td>
Ilość:
</td>
<td>
<input type="text" id="ip3" />
</td>
</tr>
<tr>
<td>
Cena:
</td>
<td>
<input type="text" id="ip4" />
</td>
</tr>
<tr>
<td>
<input type="button" value="Dodaj"
onclick="populateTextArea(); " />
</td>
<td>
<input type="button" value="Zresetuj"
onclick="resetOnlyThese()" />
</td>
</tr>
<tr>
<td colspan="2">
<textarea type="text" readonly="readonly" name="display" id="display" cols="70" rows="10" tabindex="4">
</textarea>
</td>
</tr>
JS code:
function populateTextArea()
{
var output = new Array();
var fieldID = 1;
while (fieldObj = document.order['ip'+fieldID])
{
if (fieldObj.length)
{
for (var j=0; j<fieldObj.length; j++)
{
output[output.length] = fieldObj[j].value;
}
}
else
{
output[output.length] = fieldObj.value;
}
fieldID++;
}
document.getElementById('display').value = output.join(' | ');
}
Thanks for any future help