|
Q175 How can I write the contents of a textarea to another frame whilst retaining the line breaks?
irt.org | Knowledge Base | JavaScript | Form 3.3 | Q175 [ previous next ]
Q175 How can I write the contents of a textarea to another frame whilst retaining the line breaks?
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:
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>
|
|
|
Copyright © 1996-2008 irt.org, All Rights Reserved.