开发者社区> 问答> 正文

js怎么获取背景颜色

js怎么获取背景颜色

展开
收起
云计算小粉 2018-05-10 19:59:35 2398 0
1 条回答
写回答
取消 提交回答
  • 努力在努力

    HTMLElement.prototype.__defineGetter__("currentStyle", function () {
    return this.ownerDocument.defaultView.getComputedStyle(this, null);
    });

    function fun(){

    var color = document.body.currentStyle.backgroundColor;
    alert(color);

    }

    2019-07-17 22:10:00
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
JavaScript函数 立即下载
Delivering Javascript to World 立即下载
编程语言如何演化-以JS的private为例 立即下载