// 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 Advocates: simple, powerful, and elegantly ', function () {alert ('yes ');});
};
})();