I have a few funtions for validation and I want to add events to every element in array. 

```js
var items=[
    "metraz_od",
    "metraz_do",
    "cena_za_metr_od",
    "cena_za_metr_do",
    "cena_od",
    "cena_do",
    "pietro_min",
    "pietro_max",
    "rok_budowy_od",
    "rok_budowy_do",
    "ilosc_pieter_od",
    "ilosc_pieter_do",
    "minimalna_wysokosc"
];
var items_float=[
    "cena_tys"
];

function add_events(array, event, function_name){
    for(var i=0; i<array.length; i++){
        (function(e){
            console.log("W funkcji "+array+" | "+event+" | "+function_name+" | ");
            document.getElementsByName(items[e])[0].addEventListener(event, function() {
            function_name(array[e]) 
            })
        })(i); 
    }
}

add_events(items,"keyup","validate_numb");
```

But it isn't working, propably because of using function name (string) as function argument (function add\_events) - i think i can't do that :D 

What can I do instad of?

EDIT: this is that function:

```js
function validate_numb(name){//argumentem jest nazwa pola
        var input = document.getElementsByName(name)[0].value;
        var parsed_input = parseInt(input);//wartosc pola zamieniana na liczbe całkowitą
        if(isNaN(parsed_input) || parsed_input<0 || input!=parsed_input){
            document.getElementsByName(name)[0].value="";
            console.log("Validation of "+name+" failed");
            return false;
        }else{
            return true;
        }
    }
```