I have some code to preview text entered in a textarea. It opens a new window for the preview but I'd like to write the preview to an iframe when the button is clicked. Can this be done? Here's the code for the preview window.
PHP Code:
<SCRIPT language=\"JavaScript\">
function ShowPreview()
{
var hWndPreviewWindow = window.open(\"\",\"Preview\",\"width=400,height=250,scrollbars=yes,resizable=yes,status=0\");
hWndPreviewWindow.document.open();
hWndPreviewWindow.document.writeln('<HTML><HEAD><TITLE>Preview Message</TITLE></HEAD>');
hWndPreviewWindow.document.writeln('<BODY BGCOLOR=\"lightyellow\">');
hWndPreviewWindow.document.writeln('<B>This is how your post will look</B>');
hWndPreviewWindow.document.writeln('<A HREF=\"javascript:window.close()\">Close Preview</A><BR><BR><BR>');
var Cont = document.msgform.message.value;
Cont = Cont.replace(/\[B]/ig,'<b>')
Cont = Cont.replace(/\[\/B]/ig,'</b>')
Cont = Cont.replace(/\[I]/ig,'<i>')
Cont = Cont.replace(/\[\/I]/ig,'</i>')
Cont = Cont.replace(/\[U]/ig,'<U>')
Cont = Cont.replace(/\[\/U]/ig,'</U>')
hWndPreviewWindow.document.writeln(Cont);
hWndPreviewWindow.document.writeln('</BODY></HTML>');
hWndPreviewWindow.document.close();
}
</SCRIPT>
<INPUT TYPE=BUTTON VALUE="Preview" ONCLICK="javascript:ShowPreview()"
id=PreviewButton name=PreviewButton>
|