iframe 不使用滚动条显示所有的内容

来源:互联网 发布:便笺的元数据 编辑:程序博客网 时间:2024/05/17 03:55
1.html<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><script language="javascript">var timeIframe;window.onload=function(){timeIframe=setTimeout(GetIframeStatus,10);}function GetIframeStatus() {  var iframe = document.getElementById("iframe");  var iframeWindow=iframe.contentWindow;  //内容是否加载完  if(iframeWindow.document.readyState=="complete")  {   var iframeWidth,iframeHeight;   //获取Iframe的内容实际宽度   iframeWidth=iframeWindow.document.documentElement.scrollWidth;   //获取Iframe的内容实际高度   iframeHeight=iframeWindow.document.documentElement.scrollHeight;       //设置Iframe的宽度   iframe.width=iframeWidth;   //设置Iframe的高度   iframe.height=iframeHeight;  }  else  {   timeIframe=setTimeout(GetIframeStatus,10);  } }</script></head><body><div class="topbar">     这里是topbar琐碎按钮</div><div class="wrap"><div class="logo">这里是banner</div><div class="navl"><div class="navr"><div class="navc">这里是导航</div></div></div><iframe id="iframe" name="abc" src="2.html" width="960px" scrolling="no"></iframe></div></body></html>2.html<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title></head><body><p>122222222222222222222</p><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><p>bbbbbbbbbbbbbbbbbbb </p></body></html>
0 0
原创粉丝点击