[英]Create full HTML file using partial HTML
I have a main html page (index.html) and need to construct that page page dynamically combining several html files (custom_header_page.html/ custom_content_page.html/ custom_footer_page.html)
. 我有一个主要的html页面(index.html),并且需要动态组合几个html文件
(custom_header_page.html/ custom_content_page.html/ custom_footer_page.html)
来构造该页面页面。
I am looking for a way to get it done without any server side scripting invloving. 我正在寻找一种无需任何服务器端脚本编写即可完成的方法。
Eg: 例如:
custom_header_page.html custom_header_page.html
custom_body_page.html custom_body_page.html
custom_footer_page.html custom_footer_page.html
Just tired with following in the index.html file and yes it loads properly but I want to override the <head> </head>
content of my index.html with what I have added in "custom_header.html" file. 只是对index.html文件中的内容感到厌倦,是的,它可以正确加载,但是我想用在“ custom_header.html”文件中添加的内容覆盖index.html的
<head> </head>
内容。
index.html index.html
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" type="text/javascript"> </script>
<title>Title</title>
</head>
<body>
<div id="custom_header"></div>
<div id="custom_body"></div>
<div id="custom_footer"></div>
<script>
$(function(){
$("#custom_header").load("custom_header_page.html");
$("#custom_body").load("custom_body_page.html");
$("#custom_footer").load("custom_footer_page.html");
});
</script>
</body>
您不能在不使用服务器端(例如php)的情况下编辑文件,可以使用jquery编辑html标头,但这只能在本地浏览器上进行,其他用户都不会改变。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.