本文介绍了将自定义函数绑定到原型中的DOM事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Jquery有一个很棒的语言结构,如下所示:
Jquery has a great language construct that looks like this:
$(document).ready(function() {
$("a").click(function() {
alert("Hello world!");
});
});
您可能会猜到这一点,一旦文档加载,将一个自定义函数绑定到onClick事件所有 标签。
As you might guess this, once the document has loaded, binds a custom function to the onClick event of all a tags.
问题是,如何在Prototype中实现同样的行为? / p>
The question is, how can I achieve this same kind of behavior in Prototype?
推荐答案
Prototype 1.6提供了迭代器由阵列返回的()。
I also use the each iterator on the array returned by $$().
这篇关于将自定义函数绑定到原型中的DOM事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!