View Full Version : Adding specific multiline text to a Text Area

07-16-2003, 01:40 AM
I require a function that adds multiple lines of text to what already exists in the text area. This is what i came up with but am unsure why it dont work :confused:
Its to create functions similar to those link and Bold buttons in the forum here but to add HTML in this case its adding a table with 2 columns.

<script language = Javascript 1.2>
Function addtableone();
document.form2.para1.value = document.form2.para1.value + vbcrlf + "<table width='100%' bgcolor=''>" + vbcrlf + "<tr>" + vbcrlf + "<td width='50%'>INSERT COLUMN 1 CONTENT HERE</td>" + vbcrlf + "</tr>" + vbcrlf + "<tr>" + vbcrlf + "<td width='50%'>INSERT COLUMN 2 CONTENT HERE</td>" + vbcrlf + "</tr>" + vbcrlf + "</table>"

and to execute the Function:
<input type="button" name="fnTableOne" value="ADD TABLE" onClick="addtableone();">

Surely this is a rather easy thing to fix, hopefully :)

07-16-2003, 01:46 AM
1) function (lowercase)
2) document.form2.para1.value += (shorthand)
3) Use single quotes for your JS string, doubles for HTML. Not absolutely required, but nicer.