兼容版~IE,FF,opera,safari:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Rank's HTML document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta http-equiv="ImageToolbar" content="no" />
<meta http-equiv="Creator.name" content="Rank, BlueDestiny, never-online" />
<style type="text/css" title="default" media="screen">
/*<![CDATA[*/ /*]]>*/
</style> </head>
<body>
<script type="text/javascript">//<![CDATA[
onload = function () {
function insertBox(id) { return '<input id="' +id+ '" value="never-online.net/blog">'; }
var sHTML = insertBox('myid') +'<a href="http://www.never-online.net">never-online</a>';
var iframe=document.getElementById('frm').contentWindow;
iframe.document.designMode="on";
iframe.document.writeln('<body id="never-online.net"></body>');
if(!!window.ActiveXObject) {
iframe.document.body.focus();
var doc=iframe.document;
var range= doc.selection.createRange();
if(doc.selection.type=="Control") {
var range2=doc.body.createTextRange();
range2.moveToElementText(range.item(0));
range2.select();
range=range2;
}
range.pasteHTML(sHTML);
} else {
iframe.document.execCommand('insertHTML',false,sHTML);
}
alert(iframe.document.body.innerHTML)
}//]]></script>
<iframe src="about:blank" id="frm"></iframe>
</body>
</html>
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Rank's HTML document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta http-equiv="ImageToolbar" content="no" />
<meta http-equiv="Creator.name" content="Rank, BlueDestiny, never-online" />
<style type="text/css" title="default" media="screen">
/*<![CDATA[*/ /*]]>*/
</style> </head>
<body>
<script type="text/javascript">//<![CDATA[
onload = function () {
function insertBox(id) { return '<input id="' +id+ '" value="never-online.net/blog">'; }
var sHTML = insertBox('myid') +'<a href="http://www.never-online.net">never-online</a>';
var iframe=document.getElementById('frm').contentWindow;
iframe.document.designMode="on";
iframe.document.writeln('<body id="never-online.net"></body>');
if(!!window.ActiveXObject) {
iframe.document.body.focus();
var doc=iframe.document;
var range= doc.selection.createRange();
if(doc.selection.type=="Control") {
var range2=doc.body.createTextRange();
range2.moveToElementText(range.item(0));
range2.select();
range=range2;
}
range.pasteHTML(sHTML);
} else {
iframe.document.execCommand('insertHTML',false,sHTML);
}
alert(iframe.document.body.innerHTML)
}//]]></script>
<iframe src="about:blank" id="frm"></iframe>
</body>
</html>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货