HTML5 loading JS Reference

Source: Internet
Author: User

Directly on the code

W file

<?xml version= "1.0" encoding= "UTF-8"?

;


<div xmlns= "http://www.w3.org/1999/xhtml" xid= "window" class= "window" component= "$UI/system/ Components/justep/window/window "design=" Device:mobile ">  
  <div component=" $UI/system/ Components/justep/model/model "xid=" model "/>&NBSP;
 

  <a component= "$UI/system/components/justep/button/button"
  class= "btn Btn-default "onclick=" Importinnerbtnclick "
    <i xid=" I1 "></I>
    < Span xid= "Span1" > Load UI2, AMD-compliant file </span>
  </a>
  <a component= "$UI/system/ Components/justep/button/button " class=" btn Btn-default "
  label=" into the extranet, AMD-compliant files "xid=" Importoutterbtn "onclick=" Importoutterbtnclick ",
     <i xid=" I2 "></I>
     <span xid= "span2" > On-board, AMD compliant file </span>
  </a>
</d


JS file

Define (function (require) {
var $ = require ("jquery");
var justep = require ("$UI/system/lib/justep");

var Model = function () {
This.callparent ();
};
Model.prototype.importinnerbtnclick=function (event) {
Files that comply with AMD specifications, loaded into UI2
var path= "./amd2";
Require ([Path],function (m) {
M.FNOFAMD2 ();
});

}
Model.prototype.importoutterbtnclick=function (event) {
var path= "Http://localhost:8080/cn/wp-content/uploads/2015/04/outterAMD2.js"
Require ([Path],function (m) {
M.FNOFOUTTERAMD2 ();
})
}
return Model;
});


JS files that need to be referenced

Define
function (require) {
return{
Fnofamd2:function () {
Alert ("Hello AMD2");
}
};
});


There will be two buttons in the program

Reference to external JS file successfully referenced the network JS file failed

HTML5 loading JS Reference

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.