Justin’s Blog

Web developer, I love this game.

小问题记录,!important属性,对JS的影响

March 18th, 2008 by Justin

今天调一个JS,搞了半天,怎么弄都没法改变一个DIV的高度.

查来查去, 最后发现, 原来CSS中写了!important, 

这样一来,无论是 YAHOO.util.Dom.setStyle 还是直接改变x.style.height都不起作用, 浏览器都认!imgportant,特别是FF.

 记录下


Posted in FED


2 Responses to “小问题记录,!important属性,对JS的影响”

大猫 | March 18th, 2008 at 5:13 pm

呃…上次问你的在dtd为transitional情况下的图片循环跑马灯显示代码…
嗷呜嗷呜,忘掉了吧….


xhlv | November 8th, 2008 at 9:57 pm

可以这样:

document.getElementById(“x”).setAttribute(“style”,”height:50px!important”)


Leave a Reply