[quote=yondaime4th]ini css lama mbak. .
mulai pertama bikin js saya pake css ini. .
mungkin yg baru kaya punya si boim. .[/quote]
Yang punya ryn bentuknya begini
var css = document.createElement("link");
css.type = "text/css";
css.rel = "stylesheet";
css.href = "URL CSS";
css.media = "screen, print";
document.getElementsByTagName("head")[0].appendChild(css);
Punya bang yondaime4th
/***** CSS INJECTION *****/
var css;
try {
css = document.createElement("link");
}catch(e) {
css = document.createElement("<link>");
}
css.setAttribute("type","text/css");
css.setAttribute("rel","stylesheet");
css.setAttribute("href","URL CSS");
css.setAttribute("media","screen, print");
document.getElementsByTagName("head")[0].appendChild(css);
Nah punya bang boim
function injectcss() {
if(window.cssinjected == undefined) {
cssinjected = 1;
var css = document.createElement("link");
css.setAttribute("type","text/css");
css.setAttribute("rel","stylesheet");
css.setAttribute("href","URL CSS EKSTERNAL");
css.setAttribute("media","screen, print");
document.getElementsByTagName("head")[0].appendChild(css);
}
}injectcss();
JAdi yang bener2 bisa dipake yang mana nie? Atau yang mana2 aja, sama ya?