FF does not support outerhtml, and special handling is required to implement outerHTML
Ideas are as follows:
Add a new element A to the page, clone a copy of the element that needs to get outerhtml, append the element to the new A, and get a innerhtml.
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title>»ñÈ¡outerHMTL</title>
<style type= "Text/css" >
div{background: #0000FF; width:100px;height:100px;}
span{background: #00FF00; width:100px;height:100px;}
p{background: #FF0000; width:100px;height:100px;}
</style>
<body>
<div id= "a" ><span>SPAN</span>DIV</div>
<span>SPAN</span>
<p>P</p>
<script type= "Text/javascript" >
function getouterhtml (ID) {
var el = document.getElementById (ID);
var newNode = document.createelement ("div");
Document.body.appendChild (NewNode);
var clone = El.clonenode (true);
Newnode.appendchild (clone);
alert (newnode.innerhtml);
Document.body.removeChild (NewNode);
}
Window.onload = function () {getouterhtml ("a");}
</script>
</body>