Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript include js file

function loadScript( url, callback ) {
  var script = document.createElement( "script" )
  	  script.type = "text/javascript";
      script.src = url;
 	  script.onload = function() {
     	callback()
      };
     document.head.appendChild(script); 
}
// call the function...
loadScript("js/myscript.js", function() {
  alert('script ready!'); 
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #include #js #file
ADD COMMENT
Topic
Name
3+7 =