【发布时间】:2017-02-17 02:02:12
【问题描述】:
当下面的函数调用运行时,它会返回此错误。 “未捕获的类型错误:无法读取属性 'backgroundColor' undefined" 我正在尝试更改名为的类的背景颜色 .jumbotron。到目前为止,我已经尝试了所有我能做的事情。
Could anyone tell me why this is happening?
clrElementJumbo("cornsilk");
function clrElementJumbo(scolor) {
var el = document.getElementsByClassName("jumbotron");
el.style.backgroundColor = scolor;
}
【问题讨论】:
标签: properties undefined