ncjazz Posted October 5, 2017 Share Posted October 5, 2017 Hi; I'm new to this forum and to Script Includes. I am trying to create an html website with multiple pages. I am trying to insert a header into each page. I copied a Script Includes from another forums website. This is not working for me. Any help I can get would be appreciated. Here is what I wrote for my index.html: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Home - Council 9709</title> <link href="kofc_style.css" type="text/css" rel="stylesheet" /> <script src="js/councilHeader.js"></script> <style type="text/css"> .auto-style1 { text-align: center; vertical-align: central; margin-bottom: 10px; } </style> </head> <body> <!-- Start of Banner/Menu --> <script> var foo = new NewInclude(); foo.myFunction(); </script> <!-- End of Banner/Menu --> <!-- Start of Content Section (mid-page) --> HTML content code here <!-- End of Content Section (mid-page) --> I have the following in my councilHeader.js file: // JavaScript source code var NewInclude = Class.create(); NewInclude.prototype = { initialize: function () { }, myFunction: function () { <table style="width: 100%;"> <tr class="td1 bg_blue center"> <td> <img src="graphics/logo.png" /> </td> <td> Web site name/banner</td> <td> <img src="graphics/triangle.jpg" /> </td> </tr> <tr> <td colspan="3">Website Menu</td> </tr> </table> }, type: 'NewInclude' }; Link to comment Share on other sites More sharing options...
Dodra Posted October 10, 2017 Share Posted October 10, 2017 This sounds like a question for the JavaScript subforum. But here goes: I myself use PHP to include content. I like PHP a little more for that. All you need is: <?php include 'myurl.php'; ?> Another benefit from PHP is that it is server side. Client side script, like JavaScript can be alterd or disabled by the user. While this is not possible with PHP. If you would like to use JavaScript, then the following tutorial might be usefull for you: https://www.w3schools.com/howto/howto_html_include.asp Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now