How to handle common code in multiple HTML's using javascript or jQuery

后端 未结 4 2095
长情又很酷
长情又很酷 2021-02-13 17:40

I have an application which has almost 30 html\'s and they share some common code to which i f i made any changes i need to change it on every page. Below is the piece of code w

4条回答
  •  误落风尘
    2021-02-13 18:03

    You already got answer for PHP, but if you don't want or can't use it you can save it in JS file: test.js

    document.write('
    \n\
      \n\
    • \n\
    • \n\
    • \n\
    • \n\
    \n\
    ');

    and include it:

    
    

    But of course better with PHP.

提交回复
热议问题