0

I was trying to include an HTML file in another HTML File div like follows,

 <body>
  <form action="#" method="post">
     <div class="container">
        <div class="sidebar">
           <!-- Do not insert any tags here -->
        </div>
        <div class="contentbody">
          <div class="titlearea">
              <div class="userprofile"></div>
              <div class="pageheading">
                 <h1>Page Heading</h1>
              </div>
           </div>
           <div class="formarea">
              <!-- This is where I have to put the html page which contains a navigatin menu-->

                        <!--#include virtual="menuset1.html" --> 

           </div>
        </div>
     </div>
  </form>

But when I run it on chrome it doesn't show up (menuset1), when I test it on dreamweaver it appears from behind of all elements and not in the correct position, Please guide me on this.

Dilukshan Mahendra
  • 2,572
  • 7
  • 33
  • 58
  • 1
    Looks like including files like this is server dependant, I would recommend using php `` - There are also lots of answers to this question already - [http://stackoverflow.com/questions/8988855/include-another-html-file-in-a-html-file](http://stackoverflow.com/questions/8988855/include-another-html-file-in-a-html-file) – Wez Sep 23 '13 at 07:42
  • This is for a project in JSP & Servlets – Dilukshan Mahendra Sep 23 '13 at 08:08

1 Answers1

0

I think you should use jquery like,

<head>
   <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body>
  ....
  ....
  <script> 
    $(function(){
       $(".formarea").load("menuset1.html"); 
    });
  </script> 

Or use PHP like,

<div class="formarea">
    <?php
      include('menuset1.html');
    ?>
</div>

Read php inclusion of files

Rohan Kumar
  • 38,998
  • 11
  • 69
  • 99