开发者

unexpected call to method or property access

开发者 https://www.devze.com 2023-03-30 02:13 出处:网络
If you try to add style declarations in the head of a document, IE borks at the name \'style\' - \"unexpected call to method or property access\".

If you try to add style declarations in the head of a document, IE borks at the name 'style' - "unexpected call to method or property access".

I guess its getting confus开发者_如何学JAVAed between the head element and the object property .style?

var t = document.createElement("style")
t.setAttribute("type", "text/css");
t.setAttribute("media", "screen");
var temp_text = document.createTextNode(v + " {visibility:hidden}");
t.appendChild(temp_text)

Where v is id of a flash object.


This might help: http://www.phpied.com/dynamic-script-and-style-elements-in-ie/


For IE U have do like this

    var t = document.createElement("style")
    t.setAttribute("type", "text/css");
    t.setAttribute("media", "screen");
    if(t.styleSheet)
        t.styleSheet.cssText = v + " {visibility:hidden}" ;
    else
    {
        var temp_text = document.createTextNode(v + " {visibility:hidden}");
        t.appendChild(temp_text)
    }

This would help you

0

精彩评论

暂无评论...
验证码 换一张
取 消