CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2007
    Posts
    405

    How to load html page into the main page ?

    Suppose I have 2 files: Main.html and Home.html, in Main.html page there is html code with the following menu:

    Code:
     
     
    <div class="container">
    <div id="menu">
    <ul class="nav justify-content-center">
    <li class="nav-item"><a class="nav-link" href="Home.html">Home</a></li>
    <li class="nav-item"><a class="nav-link" href="#">ServiceForum</a></li>
    <li class="nav-item"><a class="nav-link" href="#">Question</a></li>
    <li class="nav-item"><a class="nav-link" href="#">Forum</a></li>
    <li class="nav-item"><a class="nav-link" href="#">Contac</a></li>
    </ul>
    </div>
    </div>
    When I click on "Home" from the menu, the Home.html is opened but not in the green area of the Main.html page, so when I click on "Home" from the menu, how do I edit the above code? In addition, when Home loaded by default is also loaded in the green area, how is the above code written? You see the attached photo file: http://www.mediafire.com/view/gl9wr7...WebEn.jpg/file

  2. #2
    Join Date
    Jun 2021
    Posts
    10

    Smile Re: How to load html page into the main page ?

    You can use jQuery
    HTML Code:
    <html> 
      <head> 
        <script src="jquery.js"></script> 
        <script> 
        $(function(){
          $("#divId").load("b.html"); 
        });
        </script> 
      </head> 
    
      <body> 
         <div id="divId" style="display:none;"></div>
      </body> 
    </html>
    Last edited by 2kaud; June 30th, 2021 at 05:17 AM. Reason: Removed advertising link

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured