通过原型javascript更改类中所有元素的样式

通过原型javascript更改类中所有元素的样式,javascript,html,css,prototypejs,Javascript,Html,Css,Prototypejs,这可能非常简单,但是$$(函数)上的原型文档非常糟糕。一旦函数将所有项目提供给我,我该如何处理它们 首先,我尝试: $$('div.category').style.height = 400 +"px"; 然后: 最后: for (x in $$('div.category')) { x.style.height = 400 +"px"; } 他们都没有工作。帮忙 $$('div.category').each(function(d){ d.style.height = '4

这可能非常简单,但是$$(函数)上的原型文档非常糟糕。一旦函数将所有项目提供给我,我该如何处理它们

首先,我尝试:

$$('div.category').style.height = 400 +"px";
然后:

最后:

for (x in $$('div.category'))
{
    x.style.height = 400 +"px";
}
他们都没有工作。帮忙

$$('div.category').each(function(d){
    d.style.height = '400px';
});
阅读更多关于

$$('div.category').each(function(d){
    d.style.height = '400px';
});
$$('div.category').invoke('setStyle', { height: '400px' });