I have a two framed window with a textarea for user input, and whenever text is typed in the textarea, the second frame is updated with a print preview based on the textarea. The problem I'm having is that when the user comes to the end of a line in the textarea it wraps to the next line, but the preview window (with a <TD> that contains the textarea's value) just continues on the same line, with a horizontal scroll bar - it doesn't go to the next line in the preview unless the user manually presses enter in the textarea. I have an update function that writes the textarea's value to the preview frame on each keypress in the textarea. How do I get the function to send a \n to the preview when the user gets to the end of a line in the textarea, instead of doing a 'hard' wrap which doesn't get written from the textarea.value to the preview's <TD>?
the textarea:
<TEXTAREA name = "memotext" Rows = "10" Cols = "100" Wrap = "hard" onKeyUp="updatePreview();" STYLE="font:normal normal 10pt Arial"><%=objRS("btDescription"
%></TEXTAREA>
the update function:
function updatePreview() {
if(parent.frmprev.memospan) parent.frmprev.memospan.innerHTML = "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR HEIGHT=18><TD WIDTH=74><BR></TD><TD WIDTH=489 STYLE = \"line-height:100%\"><PRE><FONT SIZE=2 FACE=Arial COLOR=#000000>" + document.memoform.memotext.value + "</FONT></PRE></TD>";
}
the textarea:
<TEXTAREA name = "memotext" Rows = "10" Cols = "100" Wrap = "hard" onKeyUp="updatePreview();" STYLE="font:normal normal 10pt Arial"><%=objRS("btDescription"
the update function:
function updatePreview() {
if(parent.frmprev.memospan) parent.frmprev.memospan.innerHTML = "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR HEIGHT=18><TD WIDTH=74><BR></TD><TD WIDTH=489 STYLE = \"line-height:100%\"><PRE><FONT SIZE=2 FACE=Arial COLOR=#000000>" + document.memoform.memotext.value + "</FONT></PRE></TD>";
}