简体   繁体   English

加载多个元素后执行函数

[英]Execute function after multiple elements were loaded

我找不到如何将事件绑定到ext.js中的几个元素,也没有找到初始化页面上所有元素后触发的任何特定事件,所以我想问如何将事件绑定到页面上的几个元素或触发它页面上的所有组件都会被初始化。

in the load event of the body just attach the event what ever it is to what ever elements 在身体的负载事件中,只需将事件附加到元素上即可

Example Java Script 示例Java脚本

window.onload = function()
{
var Elements = document.getElementsByTagName('INPUT');
for(var i =0;i<Elements.length;i++)
{
Elements[i].onclick = function(e)
{
//do what you want to do here to be handled on the onclick event
}
}
}

Regards i am here for any comments 问候我在这里有任何评论

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM