简体   繁体   中英

javascript for specific web page

currently I have different javascript onload commands for each of my web pages. Is it possible to compile all of them in one javascript file and assign the functions to a specific web page? I'm currently working with an ASP.net MVC project, so I load a Layout.html when I start my application. I guess what I want is to only have a single javascript file and load it in my layout.html, and when I open another page a specific javascript function will run.

为每个页面的body onLoad附加函数。

Load your script from Layout page and just set this layout page as layout in all other views. You can load function from that script from any view page. you don't need to load script file on every page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM