首页 > Web开发 > 详细

html引入另一个html

时间:2017-02-24 12:19:18      阅读:281      评论:0      收藏:0      [点我收藏+]

在写页面的时候,有些东西是一样的,比如头部的导航或者尾部的标注。所以复用的东西可以写到一个文件中,之后再引入,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执行后的内容合并成一个页面)


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就可以了



html引入另一个html

原文:http://www.cnblogs.com/liziyou/p/6437701.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!