How to dynamically load content into DIV using Javascript

前端 未结 2 1266
Happy的楠姐
Happy的楠姐 2021-01-16 01:02

I have a website which consists of 5 different pages.

To maintain the design of all the pages, I copied and pasted the code from the main page to all the other HTML

2条回答
  •  孤街浪徒
    2021-01-16 01:42

    Alright so my approach is a bit different as I use PHP but hopefully I am still able to help you with this. I am working on something similar where I have "index" page that includes a nav bar at the top and empty space below it. After I click on something the content of another php file loads into white space, and said another php file is wrapped into a div I can edit with css. To do this I've used this php command:

    This should be it. I don't know php very well and one of my collegues suggested to use this but it's relatively small amount of code and it works well.

提交回复
热议问题