I want to loop through the buttons 30 times a second i have an array in which i have listed the buttons
function Btn_check(){
for(var i in buttons){
var buttons_name = [];
buttons_name[i] = buttons[i].name+'_Btn';
document.getElementById(buttons_name[i]).onclick = function() {
//do something here
}
}
}
setInterval(Btn_check(), 1000/30);
in my HTML i just have a list of buttons like so
<a href="#" id="1_Btn" class="button">1</a>
<a href="#" id="2_Btn" class="button">2</a>
<a href="#" id="3_Btn" class="button">3</a>
//etc...
always when i click on a button it thinks i clicked the last button on the page