Getting a DHTML node as an html string

I've created a 'div' using DHTML. Is it possible to see what it looks like as a string of HTML. So something like this:

var d=document.createElement('DIV');'1px solid';
d.innerHTML='Hi there';

Converted into:

'<DIV STYLE="border:1px solid">Hi there</DIV>'
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

There is an outerHTML property that would return the full HTML as a string but this is only supported in IE. However, there was already a post on this site with this issue where some experts have provided workarounds.

How to get outerHTML in IE and Mozilla (Netscape)
Michel PlungjanIT ExpertCommented:
Since I cannot add to that question, here is a combination of yours and theirs with your dynamic generation used for the hidden div:

<div id="theDiv" style="border:solid 1px red;width:300">
<p>def </p>

<form id="abc" name="myForm" action="" target="_blank">
  <p><input type="text" name="t2"> <input> <input type="submit"> </p>

var d=document.createElement('DIV');"x";'1px solid';
d.innerHTML='Hi there';

function getOuterHTML(obj){
 var temp=document.getElementById(obj).cloneNode(true)
 var d=document.createElement('DIV');'none';
 var outer=d.innerHTML
 return outer


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.