用document.close()实现清屏,参考
<frameset name=myfrmset rows="80%,*">
<frame name=show src=show.htm>
<frame name=send src=chat.htm>
</frameset>
chat.htm
<body onload=document.all.message.focus()>
<form onsubmit="parent.show.document.write(document.all.message.value+'<br>')">
<input name=message>
<input type=button value=send onclick="parent.show.document.write(document.all.message.value+'<br>');document.all.message.value='';document.all.message.focus()">
<input type=button onclick="parent.show.document.close();parent.show.document.write('');document.all.message.focus()" name="clearScreen" value="clear">
</form>
<frameset name=myfrmset rows="80%,*">
<frame name=show src=show.htm>
<frame name=send src=chat.htm>
</frameset>
chat.htm
<body onload=document.all.message.focus()>
<form onsubmit="parent.show.document.write(document.all.message.value+'<br>')">
<input name=message>
<input type=button value=send onclick="parent.show.document.write(document.all.message.value+'<br>');document.all.message.value='';document.all.message.focus()">
<input type=button onclick="parent.show.document.close();parent.show.document.write('');document.all.message.focus()" name="clearScreen" value="clear">
</form>
asdfagj<BR>
asgl;sdkf<BR>
asdlg;ksdfg<BR>
<button onclick="document.body.innerText ='' ">test</button>
</body>
开什么玩笑,整个页面什么都没有了,那我还要这个页面干吗呀。
再想个好的办法,我也遇到这个问题,没办法只好用api了,可是速度会慢。
window.close()
window.open()
也不好用。