0
查询代表对象名称当您看到以下示例时,事情就会很清楚。通过函数参数
function AddStyle(prob, value) {
Elem = document.getElementById('box');
Elem.style.prob = value;
}
// Here is, when usage.
AddStyle('backgroundColor', 'red');
正如你在前面的例子中所看到的,我们有两个参数(prob
是属性名称),(value
是属性的值)。
该示例不起作用,没有错误也会出现。 我敢肯定,这一行Elem.style.prob = value;
,特别是这里的问题style.prob
。