<iframe id="frame" name="frame" style="width:80%;margin:20px;border:1px #69f solid" ></iframe>
<script type="text/javascript">
$(function(){
var iframe = window.frames['frame'];
iframe.document.open();
iframe.document.write('<div id="linuxresult" >的撒和大家喀什的凯撒</div>');
iframe.document.close();
});
function setIframe(){
var rs = document.getElementById('frame').contentWindow.document.getElementById('linuxresult');
//console.log(rs);
var p = document.createElement("span");
p.innerHTML = msg.data;
rs.appendChild(p);
var br = document.createElement("br");
rs.appendChild(br);
var ww = document.getElementById('frame').contentWindow.document.body.scrollHeight; //获取iframe滚动条高度
console.log(ww);
document.getElementById('frame').contentWindow.document.body.scrollTop = ww; //设置滚动条始终在最后
var qq = document.getElementById('frame').contentWindow.document.body.scrollTop;
console.log(qq);
}
</script>