<script>function SenHtmlToJs(){
var DivHtToJs=document.createElement('div'),
DivHtToJsBg=document.createElement('div'),
DivHtToJsBody=(document.body||document.getElementsByTagName('body')[0]);
DivHtToJs.style.cssText='z-index:50001; width:40%;'+
'height:55%; position:absolute; top:21%; left:30%; margin:0px;'+
' border:1px #ccc solid; border-radius:5px; -moz-border-radius:5px;'+
' -ms-border-radius:5px; -webkit-border-radius:5px; -o-border-radius:5px;'+
' -khtml-border-radius:5px; text-align:right; direction:rtl; padding:10px; '+
'background:#ffffff; background:-moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%); '+
'background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#e5e5e5)); '+
'background:-webkit-linear-gradient(top, #ffffff 0%,#e5e5e5 100%); background:-o-linear-gradient(top,#ffffff 0%,#e5e5e5 100%);'+
' background:-ms-linear-gradient(top,#ffffff 0%,#e5e5e5 100%); background:linear-gradient(to bottom,#ffffff 0%,#e5e5e5 100%);'+
' filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#ffffff\',endColorstr=\'#e5e5e5\',GradientType=0); overflow:auto;';
DivHtToJs.id='DivHtToJs';
DivHtToJs.innerHTML='<textarea id="sen"><\/textarea><br><button onclick="CloseSenHtmlToJs();">بستن<\/button>';
DivHtToJsBg.id='DivHtToJsBg';
DivHtToJsBg.style.cssText='display:block; background:rgba(0,0,0,.6); width:100%; height:100%; position:fixed; top:0; left:0; z-index:5000;';
DivHtToJsBg.onclick=function(){
this.parentNode.removeChild(this);
var DivHtToJs=document.getElementById('DivHtToJs'),
DivHtToJsBg=document.getElementById('DivHtToJsBg');
DivHtToJs.parentNode.removeChild(DivHtToJs);
DivHtToJsBg.parentNode.removeChild(DivHtToJsBg)};
DivHtToJsBody.appendChild(DivHtToJsBg);
DivHtToJsBody.appendChild(DivHtToJs);
}
function CloseSenHtmlToJs(){
document.getElementById('sensen').innerHTML='<textarea>'+document.getElementById('sen').value+'<\/textarea>';
var DivHtToJs=document.getElementById('DivHtToJs'),
DivHtToJsBg=document.getElementById('DivHtToJsBg');
DivHtToJs.parentNode.removeChild(DivHtToJs);
DivHtToJsBg.parentNode.removeChild(DivHtToJsBg);
}
</script>
<button onclick="SenHtmlToJs();">نمایش</button>
<div id="sensen"></div>