0
我有不同風格的網頁,用戶可以隨時更改和構建。 我有這個代碼與瀏覽器IE-9 +,鉻,FF,Safari瀏覽器一起工作。如何用另一個替換整個CSS文本?
if($("#customCss").length>0)
$("#customCss").empty();
$("#customCss").text(css_txt);
$('head').append('<style type="text/css" id="customCss"> ' + css_txt + '</style>');
我想使網站符合IE-7,8。但是這個代碼不適用於IE-7,8。我收到此錯誤代碼:
Microsoft JScript runtime error: Unexpected call to method or property access.
在此
jQuery的jQuery的FUNC:
append: function() {
return this.domManip(arguments, true, function (elem) {
if (this.nodeType === 1) {
this.appendChild(elem);
}
});
},
我也試試這個沒有運氣:
document.getElementById("customCss").innerHTML=css_txt;
任何想法,爲什麼?
嘗試使用'.textContent'而不是'.innerHTML'。 – 2013-02-17 13:14:37
也許你應該在嘗試用'$(「#customCss」)。text(css_txt);''設置其內容之前,嘗試定義'