Prototype Element对象,各种与DOM元素的相互作用提供了一个强大的DOM方法 - 建立,更新,穿越他们,等你可以访问这些作为元素本身的方法,在元素传递给工作作为第一个参数,或扩展元素的实例上的方法:
// Using Element:
Element.addClassName('target', 'highlighted');
// Using an extended element instance:
$('target').addClassName('highlighted');
元素也是从头开始构建元素的实例的构造,详见新元素.
Most Element methods return the element instance, so that you can chain them easily:
$('message').addClassName('read').update('I read this message!');
More Information
For more information about extended elements, check out "How Prototype extends the DOM", which will walk you through the inner workings of Prototype's DOM extension mechanism.
本文介绍了 Prototype JavaScript 框架中 Element 对象的各种方法,包括如何使用这些方法来操作 DOM 元素,例如添加类名、更新元素内容等,并且可以通过链式调用来简化复杂的 DOM 操作。
425

被折叠的 条评论
为什么被折叠?



