調用網頁頭部和尾部的公共部分


動態的頁面可以用包含語句把頁面引用進來。如果是純靜態頁面可以用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



免責聲明!

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



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