【前端开发】前端引入公共部分footer header的几种方法,及iframe自适应高度js

一、引入页面几种方法
 
1.IFrame引入,看看下面的代码 
 
<iframe   frameborder=0   border=0   width=300   height=300   src="b.htm" mce_src="b.htm"></iframe> 
这种高度需要限制是个问题,但经过我不懈努力终于找到了iframe自适应高度方法:
<iframe name="lanrentuku" src="http://www.lanrentuku.com/" frameborder=false scrolling="auto" width="100%" height="100%" frameborder=no onload="document.all['lanrentuku'].style.height=lanrentuku.document.body.scrollHeight" ></iframe>
2.<object>方式 
 
[ <object style="border:0px" type="text/x-scriptlet" data="import.htm" width=100% height=30></object>
 
3.Behavior的download方式 
 
<span id=showImport></span>
<IE:Download ID="oDownload" STYLE="behavior:url(#default#download)" />
<script> 
function onDownloadDone(downDate){
showImport.innerHTML=downDate
oDownload.startDownload('import.htm',onDownloadDone)
</script>
 
4.使用JQuery的load方法吧!
<div class="top"></div>
<div class="footer"></div>
 
$(document).ready(function(){ 
$(".top").load("top.html"); 
$(".footer").load("footer.html"); 
}); 
 
这里本人用的最多的则是load  iframe 这两种;
 

原文地址:https://www.cnblogs.com/xiaohuizhang/p/8880559.html