When we are going to import the js file dynamically, we can use the following method
Copy code code as follows:
var docfunc = {
/*************************************************** ************************************
* Purpose: Call the dynamic loading script method load_script below
************************************************* **************************************
loaddefjquery: function () {
//alert (ucapSession.hostpath + ucapSession.appth);
//ucapSession.apppath is the root directory
docfunc.load_script (ucapSession.apppath
+ "ftdxxglxt/js/jquery-1.8.1.min.js");
docfunc.load_script (ucapSession.apppath
+ "ftdxxglxt/js/jsuggest.js");
},
/*************************************************** ************************************
* Purpose: Dynamic loading script
************************************************* **************************************
load_script: function (url) {
var x = new actionxobject ("msxml2.xmlhttp");
x.open ('get', url, false);
x.send ('');
EVAL (x.Responsetext);
var s = x.Responsetext.split (// n/);
var r =/^(?: function | var)/s*([a-za-z _]+)/i;
for (var I = 0; I <s.length; i ++)
{{
var m = r.exec (s [i]);
if (m! = null)
{{
Window [m [1]] = EVAL (m [1]);
}
}
}
}
Call on HTML page or JSP page:
Copy code code as follows:
<script>
docfunc.loaddefjquery ();
</script>