Reading non-inline CSS style info from Javascript

前端 未结 4 1144
栀梦
栀梦 2020-12-03 09:16

I know I must be missing something here, but I cannot seem to get this to work.

I have assigned a background color to the body of an html document using the style ta

4条回答
  •  长情又很酷
    2020-12-03 10:01

    In this case, you'll want the computedStyle on the Element as the style attribute hasn't been set yet. In IE, you'll need to check the Element's currentStyle property, via something like this.

提交回复
热议问题