关注!如下示例(not work as my imagine)<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY><P> </P>
<a href="#the">go the</a>
<p> <p> <p> <p> <p> <p>
<A id=cc name=the>old book here</A><br/>
<a href="#new">go created new </a>
<p> <p> <p> <p> <p> <p> <p> <p> <p> <p>
<br/>
<input type=button value=createbook onclick="alert(document.execCommand('CreateBook','new', 'content'))" id=button3 name=button3>
<button onclick="alert(document.all[0].outerHTML)" id=button1 name=button1>View Dom</button>
<br/>
<input type=button value=createbook onclick="alert(ee.document.execCommand('CreateBook','new','content'))" id=button3 name=button3>
<button onclick="alert(ee.document.all[0].outerHTML)" id=button1 name=button1>View Frame Dom</button>
<button onclick="ee.document.designMode='on'" id=button1 name=button1>set designMode on</button>
<button onclick="ee.document.designMode='off'" id=button1 name=button1>set designMode off</button>
<div id=dd contenteditable>other content to be create book</div>
<iframe name=ee src=bookcontent.htm></iframe>
</BODY>
</HTML>
bookcontent.htm
-----------------------
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<a href="#new">go created new </a>
<P> </P><P> </P><P> </P><P> </P><P> </P></BODY>
</HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY><P> </P>
<a href="#the">go the</a>
<p> <p> <p> <p> <p> <p>
<A id=cc name=the>old book here</A><br/>
<a href="#new">go created new </a>
<p> <p> <p> <p> <p> <p> <p> <p> <p> <p>
<br/>
<input type=button value=createbook onclick="alert(document.execCommand('CreateBook','new', 'content'))" id=button3 name=button3>
<button onclick="alert(document.all[0].outerHTML)" id=button1 name=button1>View Dom</button>
<br/>
<input type=button value=createbook onclick="alert(ee.document.execCommand('CreateBook','new','content'))" id=button3 name=button3>
<button onclick="alert(ee.document.all[0].outerHTML)" id=button1 name=button1>View Frame Dom</button>
<button onclick="ee.document.designMode='on'" id=button1 name=button1>set designMode on</button>
<button onclick="ee.document.designMode='off'" id=button1 name=button1>set designMode off</button>
<div id=dd contenteditable>other content to be create book</div>
<iframe name=ee src=bookcontent.htm></iframe>
</BODY>
</HTML>
bookcontent.htm
-----------------------
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<a href="#new">go created new </a>
<P> </P><P> </P><P> </P><P> </P><P> </P></BODY>
</HTML>
在iframe中输入任意字符,选择,点击"创建描点"测试
<script>
function window.onload(){
test.document.designMode='on';
}
</script>
<iframe id=test></iframe>
<input type=button value='创建描点' onclick="test.document.execCommand('createbook',true,'abcdef');alert(test.document.all(0).outerHTML)">