I've checked google (found some functions written by people, an http service to generate the code necessary for a given piece of html [google html2dom]), javaranch archives and didn't come up with anything useful.
innerHTML is not a solution here as it won't create a DOM node.
Thanks all. Looks like I was wrong. The code given below demonstrates this. (You need to change the event name onclock to onclick)
However reading further on innerHTML I still have reservations on using it. The links here and here give and idea about the problems (and advantages) of using innerHTML.
To make things work across browsers I might be tempted to use innerDOM by Simon K�hn, which is also suggested by the Mozilla Developers Center here.
Firefox has an implementation of the Range object of the w3C's DOM Traversal and Range specification here and implements a Firefox specific method createContextualFragment here which takes an HTML string and returns a DOM Node.
I guess if something similar were to be adopted by w3C DOM API this would be the standards compliant way for innerHTML like functionality.
For simple display of HTML, innerHTML may be the choice until something better standards compliant way is available.
[ October 13, 2008: Message edited by: Gamini Sirisena ]