Your Development & Design Resource

Another simple usage for innerHTML: the DHTML Preview

Playing around the other day, I found yet another use for accessing/setting the innerHTML of a container tag: a DHTML Preview.

Upon entering text (or preferably HTML/DHTML) in the following textarea, the onkeydown, onkeyup, and onblur events trigger the preview function:

function p(src, targ) {

    targ.innerHTML = src.value;

This function then, as designed, sets the div preview to the epected markup via setting the innerHTML of said container document.

Feel free to play around, and as always, let me know what you think! For a direct link: dhtml_preview.html

About the author: Chris Toohey

Thought Leadership, Web & Mobile Application Development, Solutions Integration, Technical Writing & Mentoring

A published developer and webmaster of, Chris Toohey specializes in platform application development, solutions integration, and evangelism of platform capabilities and best practices.

More from is powered by IBM Notes Domino XPages & hosted by Prominic.NET

Contact Us

Use our Contact / Feedback form or one of these email addresses:

Creative Commons License

Except where otherwise noted, by Chris Toohey is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.