vendredi 20 février 2015

JavaScript: Convert String as Parameter to Array Name?


is it possible to convert Function Parameter string to Array name?



function SwitchElement(type){

var cur = type.indexOf(document.getElementById(type).src);
console.log(cur);
if(cur < eyes.length-1){

}
}


So that "type" is Addressed as array name.


If so, how? I am trying to do it just like that function but it returns me index -1


Note: Div of element and Arrayname share same name.





Aucun commentaire:

Enregistrer un commentaire