使用Prototype更改标签的标签?

问题描述:

我知道我可以改变一个标签ID是这样的:使用Prototype更改标签的标签?

$(someid).id = 123; 

我如何可以改变的,太?

这是我的代码有:

<label id="10" for="xyz"> 
    sometext 
</label> 

我怎样才能改变从XYZ使用原型ABC

谢谢:)

$(someid).writeAttribute( '对', 'ABC');

+0

如果我只是有一个静态字符串,如abc,这worrks不错。如果我有一个动态字符串,如下所示: 'writeAttribute('for','options_'+ someVar +'_2')' 这不起作用,因为writeAttribute函数的第二个参数必须位于引号。我怎样才能把它放在引号中? – user1540714

+0

var concatenatedVar ='options_'+ someVar +'_2'; .... writeAttribute('for',concatenatedVar);也许? –

+0

是的,这是伎俩,谢谢! – user1540714