JavaScript Tutorial/DOM Node/outerHTML
Set outerHTML (Firefox does not support the outerHTML.)
<html>
<head>
<title>OuterHTML Example</title>
<script type="text/javascript">
function useOuterHTML() {
var oDiv = document.getElementById("div1");
oDiv.outerHTML = "<P>This is a paragraph</p>";
}
</script>
</head>
<body>
<div id="div1" >This is my original text</div>
<input type="button" value="Use OuterHTML" onclick="useOuterHTML()" />
</body>
</html>