Can't Access CSS Selector's Properties from Javascript

前端 未结 5 789
隐瞒了意图╮
隐瞒了意图╮ 2020-12-06 08:21

Here\'s a very basic question: why is the finishLoading() function in the code below not able to access the \'opacity\' property for the #myStyle CSS selector? The alert doe

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-06 08:48

    this link help

    http://www.quirksmode.org/js/opacity.html

    function setOpacity(value) {
        testObj.style.opacity = value/10;
        testObj.style.filter = 'alpha(opacity=' + value*10 + ')';
    }
    

    opacity is for Mozilla and Safari, filter for Explorer. value ranges from 0 to 10.

提交回复
热议问题