动态的页面可以用包含语句把页面引用进来。如果是纯静态页面可以用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一排输出,如果不能一排输出就要用+号来连接。还要注意单双引号不能混合用,否则会显示不了
静态网页调用公共的头部和尾部
↧
↧
Trending Articles
More Pages to Explore .....