`
xinlingwuyu
  • 浏览: 135785 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Javascript Loader

阅读更多
// Core functions for Blackbird Template // written by Jeremy Edmiston (jeremyedmiston@pointloma.edu) // 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); } }
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics