You are here: irt.org | FAQ | JavaScript | Form | 3.3 | Q175 [ previous next ]
With the simple addition of the <PRE> and </PRE> tags:
frame.html:
<FRAMESET COLS="50%,*"> <FRAME SRC="linebreaks.html"> <FRAME SRC="dummy.html" NAME="otherframe"> </FRAMESET>
dummy.html:
<H1>dummy.html</H1>
linebreaks.html:
<SCRIPT LANGUAGE="JavaScript"><!--
function process() {
alert(document.myform.mytext.value);
parent.otherframe.document.writeln('<PRE>' + document.myform.mytext.value + '<\/PRE>');
}
//--></SCRIPT>
<FORM NAME="myform">
<TEXTAREA NAME="mytext" COLS="30" ROWS="10">
This
is
a
test.
</TEXTAREA>
<INPUT TYPE="BUTTON" VALUE="OK" onClick="process()">
</FORM>