Overriding previously set float using javascript in ie
I've read this question to figure out how to set 开发者_运维百科float:none on an element which already has float:right set with class.
I used element.style.cssFloat = "none", but this just added a new style property cssFloat which didn't over-ride the existing float:right. I've now fixed it using the adding/removing classes method.
But is there a way of over-riding existing float rules in ie without having to use classes?
Welcome to the wonderful world of non-standards.
Use cssFloat and styleFloat.
That said, using classes is the better approach. It keeps your presentation in the stylesheet instead of embedding it in the JavaScript.
精彩评论