External html

Joined
May 12, 2020
Messages
1
Reaction score
0
external html
how to add a header to. all html pages
1. put this in your page
<script src="https://www.3schools.com/lib/w3.js"></script>
2. then where ever you want your html code, from the separate file,
to be included to your page:
<div w3-include-html="header.html"><//div>

template (my example)
Code:
   <!doctype html>
   <head>
   <meta html-equiv="content-type....
   <meta html-equiv="content-language....
   <meta name=....
   <title>....
   <link rel="stylessheet....
   <style type="....
   </style>
   <script src="https://www.w3schools.com/lib/w3.js"></script>
   </head>
   <body background=....
   <dl>
   <dt><b><a name="....
   <div w3-include-html="header.html"></div>
   <script>w3.includeHTML();</script>
   </body>
   </html>

this did not work for me
any suggestions
thank you for your time and help
falcon
 
Joined
Aug 10, 2020
Messages
2
Reaction score
0
by PHP we can include header and footer in web. if you want to add header and footer in HTML the u should use jquery for that..
<html>
<head>
<title></title>
<script
src="https://code.jquery.com/jquery-3.3.1.js"
integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
crossorigin="anonymous">
</script>
<script>
$(function(){
$("#header").load("header.html");
$("#footer").load("footer.html");
});
</script>
</head>
<body>
<div id="header"></div>
<!--Remaining section-->
<div id="footer"></div>
</body>
</html>

use this code it will help you

Thank You
 
Last edited by a moderator:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,965
Messages
2,570,148
Members
46,710
Latest member
FredricRen

Latest Threads

Top