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('');
}else{
head.appendChild(js);
}
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.