[英]javascript for specific web page
currently I have different javascript onload commands for each of my web pages. 目前,每个网页都有不同的javascript onload命令。 Is it possible to compile all of them in one javascript file and assign the functions to a specific web page? 是否可以将所有这些文件编译到一个javascript文件中并将这些功能分配给特定的网页? I'm currently working with an ASP.net MVC project, so I load a Layout.html when I start my application. 我目前正在使用ASP.net MVC项目,因此在启动应用程序时会加载Layout.html。 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. 我想我想要的是只有一个JavaScript文件并将其加载到我的layout.html中,当我打开另一个页面时,将运行特定的javascript函数。
为每个页面的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. 您无需在每个页面上加载脚本文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.