Friday, 13 January 2012

Include Html file inside another Html file


To include the html content into another html file I have used java script.
Below is the example where I have used header content and footer content into different file
and called these two files into all files wherever header and footer requires.
Main page content
Content.html
<html>
<body>
<script type=”text/javascript” src=”header.js”> </script>
<p>
Content of the page
</p>
<script type=”text/javascript” src=”footer.js”> </script>
</body>
</html>
header.js file content
document.write(“<h1>Header</h1>”);
document.write(“<h2>Tag Line</h2>”);
footer.js file content
document.write(“<h2>Contact us</h2>”);
document.write(“<h3>9876543210</h3>”);
Out put of content.html file in Browser
Header
Tag Line
Content of the page in details
Contact us
9876543210

No comments:

Post a Comment