//DynamicLoad File(css,js)
//Edit By dj_Yang
function DynamicLoad() {
var Self = this;
this.Load = function(type, src) {
var objDynamic;
if (type == "js" || type == "vbs") {
objDynamic = document.createElement("script");
objDynamic.src = src;
if (type == "js") {
objDynamic.type = "text/javascript";
objDynamic.language = "javascript";
}
else {
objDynamic.type = "text/vbscript";
objDynamic.language = "vbscript";
}
}
else if (type == "css") {
objDynamic = document.createElement("link");
objDynamic.rel = "stylesheet";
objDynamic.type = "text/css";
objDynamic.href = src;
}
document.getElementsByTagName("head")[0].appendChild(objDynamic);
objDynamic.onload = objDynamic.onreadystatechange = function() {
if (this.readyState && this.readyState == "loading") return;
else Self.OnLoaded(src);
};
objDynamic.onerror = function() {
document.getElementsByTagName("head")[0].removeChild(objDynamic);
Self.OnFailed(src);
};
};
this.OnLoaded = function(src) {
Self.LoadedCallback(src);
};
this.LoadedCallback = function(src) {
//do something after succeed loaded
};
this.OnFailed = function(src) {
Self.FailedCallback(src);
};
this.FailedCallback = function(src) {
//do something for failed...
alert("Error!File:" + src + " load Failed!");
};
}
//Edit By dj_Yang
(function() {
//Add a select button for choice
//Load File
var oCss1 = new DynamicLoad(),
oCss2 = new DynamicLoad(),
oScript = new DynamicLoad();
oCss1.Load("css","css/art.dialog.css");
oCss2.Load("css","css/aero.css");
oScript.Load("js","js/artDialog.min.js");
//oScript.Load("js", "JS/b.js");
oScript.LoadedCallback = function() {
//alert(str);
art.dialog('artDialog崇尚:简单、强大、优雅', function(){alert('yes');});
};
})();