html引入另一个html
生活随笔
收集整理的這篇文章主要介紹了
html引入另一个html
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
在寫頁面的時候,有些東西是一樣的,比如頭部的導航或者尾部的標注。所以復(fù)用的東西可以寫到一個文件中,之后再引入,angularjs或是jsp中都有很好的標簽引入,而html沒有,但是可以借助一些方式進行引入。
angularjs文件引入
angularjs 頭部引入 <head><% include configHead.ejs %><title>后臺管理</title> </head>angularjs 尾部或中部引入 <% include homeFooter.ejs %> jsp文件引入 <%@ include file="文件名" %>//(等于是將兩個jsp合并為一個jsp)或 <jsp:include page="文件名">//(相當于將兩個jsp執(zhí)行后的內(nèi)容合并成一個頁面)
html文件引入
(1)Js方法? 引入homeHeader.html和homeFooter.html,div使用class引入
<script type="text/javascript">$(document).ready(function () {$('.configHead').load('homeHeader.html');$('.configFoot').load('homeFooter.html');});</script></head><body><header><div class="configHead">?
(2)iframe引入?
<iframe name="" frameborder="0" scrolling="no" marginwidth="0" marginheight="0" width="100%" height="170" src="homeFooter.html"></iframe>(3)css引入
可以在css定義某個class,將所需要添加的東西負載上去,之后引用該class就可以了
轉(zhuǎn)載于:https://www.cnblogs.com/liziyou/p/6437701.html
總結(jié)
以上是生活随笔為你收集整理的html引入另一个html的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Linux系统(四)LVS集群负载均衡N
- 下一篇: 软件测试HW1