JS Modular programming

Source: Internet
Author: User
In the previous page layout, if the page needs to have all HTML tags related to it, this causes a page with a lot of content, when you view the source file, it is inconvenient to compile and maintain a large string of code. In this case, you can think of writing different functional items in different

In the previous page layout

Then there must be
When there is a lot of content in a page, it is inconvenient to compile and maintain a large string of code when you view the source file, at this time, we can think of writing different function items in different JS files and combining them in front-end JS. This is the JS function module to be discussed in this article.

Create a project

Create an MVC project and create a new Index. cshtml page

Introduce Newtonsoft. Json. dll and add references to introduce json2.js and jquery-1.7.1.min.js

Page Layout

Using JS Modular programming, you do not need to manually add every tag to an HTML page. You should dynamically add HTML tags to another JS file, while the front-end page only needs to layout the page, this layout refers to placing only the DIV elements of each section. The complete front-end Page code is as follows:

    
     Home Page    
     
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.