Simple implementation of javascript file loading management, javascript Loading

Source: Internet
Author: User

Simple implementation of javascript file loading management, javascript Loading

This article describes the simple implementation of javascript file loading management. Share it with you for your reference. The details are as follows:

This section describes how to load and manage javascript files (modules,
Implement core functions of sea. js or require. js, with a line
<Script src = "js/light. js"> </script>
Load all js files.

// Load the js file on the webpage in the order of lightJs: var lightJs = [". /js/light/pre/jquery-1.8.0.min.js ",". /js/light/pre/jquery-lib.js ",". /js/light/pre/less-1.4.2.min.js ",". /js/lihgt/pre/util. js ",". /js/xla. js ",". /js/light/light_file.js "]; var light; if (! Light) light ={}; light. load = (function (lightJs) {if (! LightJs) lightJs = []; var doc = document; var head = doc. head | doc. getElementsByTagName ("head") [0] | doc.doc umentElement; for (var I = 0; I <lightJs. length; I ++) {var path = lightJs [I]; var node = doc. createElement ("script"); node. charset = "UTF-8"; node. src = path; head. appendChild (node);} return doc;} (lightJs ));

I hope this article will help you design javascript programs.

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.