iframe中如何插入html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<HTML>  
<head>  
<mce:script type="text/javascript"><!--  
var ed = null;  
window.onload = function() {  
    var o = document.getElementById("ss");   
    ed = document.all?o.contentWindow.document:o.contentDocument;  
    ed.open();  
    ed.write('<html><head><mce:style><!--  
html,body{margin:5px;font:14px;word-wrap:break-word}  
--></mce:style><style mce_bogus="1">html,body{margin:5px;font:14px;word-wrap:break-word}</style></head><body id="my_body"></body></html>');  
    ed.close();  
    ed.contentEditable = true;  
    ed.designMode = 'on';  
};  
 
function ss(){  
if(document.all)  
{  
    document.getElementById("ss").contentWindow.focus();  
    var rang = ed.selection.createRange()  
    rang.pasteHTML(rang.text+"<hr>");  
}  
else 
{  
    ed.execCommand("insertHTML",false,"<hr>");}  
}  
// --></mce:script>  
</head>  
<BODY>  
<input value="aaa" type="button" onClick="ss()">  
<IFRAME id="ss" height="200" src="about:blank" mce_src="about:blank" width="200" ></IFRAME>  
</BODY></HTML> 

你可能感兴趣的:(html,iframe,function,null,input,button)