如何在javascript中将样式属性重置为CSS默认值? [英] How to reset the style properties to their CSS defaults in javascript?
本文介绍了如何在javascript中将样式属性重置为CSS默认值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在PHP生成的页面上有几个像这样的元素:
On a php generated page there are several elements like this:
<td class="defaultTDStyle" style="color:userDefinedCustomColor" id="myTDId"></td>
因此,有一个默认样式,我应用了几个额外的样式来覆盖CSS中定义的样式。
So there is a default style and I apply several extra styles that override the style defined in the CSS.
有没有办法从javascript中删除这些添加的样式?
似乎obj.style.color =default和obj.style.color =auto不工作。如何从javascript重置颜色为CSS默认值?
Is there a way to remove these added styles from javascript? It seems the obj.style.color="default" and obj.style.color="auto" not works. How can I reset the color to the CSS default from javascript?
推荐答案
如果回忆服务, obj。 style.color =
应该可以工作...我不知道是不是。
If recollection serves, obj.style.color=""
should work... I don't know if it's right though.
这篇关于如何在javascript中将样式属性重置为CSS默认值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文