globalConfig.loadCSS = globalConfig.loadCSS || function(filename){ var fileref=document.createElement("link"); fileref.setAttribute("rel", "stylesheet"); fileref.setAttribute("type", "text/css"); fileref.setAttribute("href", filename); document.getElementsByTagName("head")[0].appendChild(fileref); }; globalConfig.loadScript = globalConfig.loadScript || function(url, callback){ var script = document.createElement('script'); script.type = "text/javascript"; if(script.readyState){ script.onreadystatechange = function(){ if(script.readyState === "loaded" || script.readyState === "complete"){ script.onreadystatechange = null; callback(); } }; }else{ script.onload = function(){ callback(); }; } script.src = url; document.getElementsByTagName("head")[0].appendChild(script); };
↧
JavaScript and CSS dynamic loading
↧