Javascript Loader

// Core functions for Blackbird Template // written by Jeremy Edmiston ([email protected]) // The functions have been adapted from various sources // and re-written to provide maximum flexibility // and compatability with various browsers. //Global Declarations var ie = (document.all) ? true : false; var scriptPath = templatePath + 'scripts/'; var stylePath = templatePath + 'styles/'; var imagePath = templatePath + 'images/'; // Detect Browser and load appropriate scripts if(ie){loadJS('ie.js')}else{loadJS('ff.js')} function loadJS(scriptName) { var head = document.getElementsByTagName('head').item(0); var js = document.createElement('script'); js.setAttribute('language','javascript'); js.setAttribute('type','text/javascript'); if (scriptName.indexOf("/")== -1) { js.setAttribute('src', scriptPath + scriptName); }else{ js.setAttribute('src', scriptName); } js.setAttribute('id',scriptName); js.setAttribute('defer','true'); if (ie){ document.write('<script language=" + js.language + " type=" + js.type + " src="+%20js.src%20+%20" id=" + js.id + "></script>'); }else{ head.appendChild(js); } }

你可能感兴趣的:(JavaScript,IE)