How can I include all JavaScript files in a directory via JavaScript file?

后端 未结 10 1369
说谎
说谎 2020-12-03 00:42

I have a bunch of JavaScript files that I would like to include in the page, but I don\'t want to have to keep writing



        
10条回答
  •  春和景丽
    2020-12-03 01:11

    You can't do that in JavaScript, since JS is executed in the browser, not in the server, so it didn't know anything about directories or other server resources.

    The best option is using a server side script like the one posted by jellyfishtree.

提交回复
热议问题