Programming Journal C#, Java, SQL and to a lesser extent HTML, CSS, XML, and regex. I made this so other programmers could benefit from my experience.

Sunday, March 2, 2008

Previewing a TextBox that has HTML with a Popup Window

Here is a nifty way to preview HTML in a TextBox. I use the ScriptManager and $get the TextBox ID before popping the window and then filling it.

<script type="text/javascript" language="javascript" >
function preview() {
var txt= $get('txtContent');
var sHTML= txt.value;
win = window.open(", ", 'popup', 'toolbar = no, status = no');
win.document.write("" + sHTML + "");
}
</script>
Reference: http://javascript.internet.com/forms/html-preview.html

No comments: