As noted earlier, outerHTML is only most fully supported in IE. Have a look at this:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
var hh='';
function outerH(el){
if(typeof el.outerHTML=='string'&&el.outerHTML.length)
return el.outerHTML;
var tmp=document.createElement('div');
tmp.appendChild(el.cloneNode(true));
setTimeout(function(){tmp=null;},200);
return tmp.innerHTML;
}
</script>
</head>
<body>
<div style="color:black;background-color:yellow;" onmouseover="alert(outerH(this));">Howdy World!</div>
<span id="test">Wazzup?<br></span>
<input type="button" onclick="hh=outerH(document.getElementById('test'));" value="Set"><br>
<input type="button" onclick="alert(hh);" value="Read">
</body>
</html>
Notes: There is probably another way of doing whatever your ultimate goal is, one that avoids this, which is pretty non-standard regardless of which method a browser may support because no future browser will ever be required to support either, and I believe that some current browsers will not support either if your page is served as (otherwise) valid XHTML.
Bookmarks