[Javascript] Line break

Peter Brunone peter at brunone.com
Thu Jun 28 18:23:46 CDT 2001


Andrew,

    I'm not sure if this is precisely what you're getting at, but adding a
hard carriage return to a textarea can be accomplished like this:

<SCRIPT LANGUAGE="JavaScript">
function addCR() {
 document.bob.myText.value = document.bob.myText.value + "\n";
 }
</SCRIPT>

<FORM NAME="bob">
<TEXTAREA NAME="myText"></TEXTAREA>
<BR>
<INPUT TYPE="BUTTON" onClick="addCR()" VALUE="return">
</FORM>

    Still don't know what exactly the <end> is supposed to signify; if I got
it wrong let me know...

Cheers,

Peter

----- Original Message -----
From: "Andrew Gibson" <andyg at ihug.co.nz>
To: <javascript at LaTech.edu>
Sent: Thursday, June 28, 2001 6:15 PM
Subject: [Javascript] Line break


> How do I add a line break.
>
> I want to change the contents of a text area from, say
>
> mycomment
>
> to
>
> mycomment
> <end>
>
> Thanks
> Andrew





More information about the Javascript mailing list