【前端開發】前端引入公共部分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 這兩種;
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM