<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
  </head>
  <body>
<iframe style="width: 100%; height:100" marginwidth="0" marginheight="0" frameborder="0" name="textmain" id="textmain" src="about:blank"></iframe>
<script language="javascript">
var newwindow;
newwindow = document.getElementById("textmain").contentWindow;
newwindow.document.open();
newwindow.document.writeln('<div id="test">');
newwindow.document.writeln('<b>she</b>is a ');
newwindow.document.writeln("</div>");
newwindow.document.onclick = "alert()";
newwindow.document.close();
newwindow.document.designMode = 'On';
newwindow.document.contentEditable = true;
newwindow.document.charset="gb2312";
function t(s)
    {
        newwindow.document.execCommand(s,false,null);
    }
function asdf(){
  window.alert(document.getElementById("textmain").contentWindow.document.getElementById("test").innerHTML);
}
</script>
<input type="button" onclick="t('UnderLine')" value="下划线" />
<input type="button" onclick="t('bold')" value="粗体" id="Button1" /> 
<input type="button" onclick="t('JustifyLeft')" value="左对齐" /> 
<input type="button" onclick="t('JustifyCenter')" value="居中对齐" /> 
<input type="button" onclick="t('JustifyRight')" value="右对齐" /> 
<input type="button" onclick="asdf()" value="弹出" /> 
  </body></HTML>