调用网页头部和尾部的公共部分

动态的页面可以用包含语句把页面引用进来。如果是纯静态页面可以用js来引用。
动态页面就不举例子了,举个静态页面的吧:index.html:
原始页面<html>
<head>
<title>test</title>
</head>
<body>
<div id="content">test content</div>
<div id="bottom">bottom</div>
</body>
</html>
下面把这个页面拆分了,首先是top页面:
top.html:document.write("<html><head><title>test</title></head><body>");
然后是bottom页面:bottom.html:document.write('<div id="bottom">bottom</div></body></html>');
最后是浏览的页面index:index.html:
<script type="text/javascript" src="top.html"></script>
<div id="content">test content</div><script type="text/javascript" src="bottom.html">
</script>
需要注意的是top和bottom页面必须用document.write()语句来输出html,
最好把所有的html一排输出,如果不能一排输出就要用+号来连接。还要注意单双引号不能混合用,否则会显示不了
1.asp,shtml 的文件引入命令
<!--#include file="../include/mayihome_com.asp" -->
2.php执行文件的引入命令
<?php include("include/header.php"); ?>
2.jsp执行文件的引入命令
<jsp:include page="miniguide.jsp" />
-----------------------
以下是web服务器支持的执行文件。
apache php5支持php
iis支持asp
tomcat支持jsp


posted @ 2013-04-13 08:27  snowinmay  阅读(6240)  评论(0编辑  收藏  举报