Sometimes, there will be more JS files referenced on the page. If the page layout is neat, once the layout is slightly uneven, the entire page will appear It's very complicated, so is there a simpler way to reference Js files? This article will discuss this issue.
Before I started, I searched on cnblogs, and sure enough there were related articles: http://www.jb51.net/article/24220.htm, but this article is The blogger is not very kind (^_^). Although he gave me a demo to download, it was a compiled program and I couldn’t see the source code. It didn’t matter if I couldn’t see the source code. There were still errors when running. After trying it later, there was still something wrong in the demo program. There is one less script.do file, and you also need to configure the ".do" application extension in IIS. The method is as follows: Select the built website in IIS, right-click "Properties" as shown below:
Let’s get back to the topic. Although I only gave a compiled demo program, after decompiling and viewing the code, I still provided some good suggestions for me to re-implement the function. I would like to express my gratitude to the blogger of that article. Thanks ^_^, let’s take a look at how I organize and manage JS files: 1. You need to add a quote on the page: Note: The value assigned after the parameter plugins is the plug-in name written in native js. Multiple plug-ins can be separated by commas ","; The value assigned after the parameter jqPlugins is the jquery plug-in name. Similarly, multiple jquery plug-in names can be separated by commas ",". 2. Add Js configuration file to the project as follows:
3. Add HttpHandle in the project's web.config file, as follows:
and
In addition, I also made the following improvements during the implementation process: 1. Compatible with IE6, IE7, IE8, Firefox, Safari, Opera browsers (tested, in the article The demo program mentioned does not function under IE6) 2. An anonymous callback function is used to avoid having the same name as the method in the loaded JS file 3. The native js plug-in and the jquery plug-in can be called at the same time. The premise is that there will be no conflict between the two
For the specific implementation, you candownload the source code. The development environment of this source code is VS2008 ASP.NET MVC 1.0
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn