+ 1
Hello everybody. As in function through parameters to change array ckam[] on other array ckam2[]?
function opred(){//опред.координат. left без px for(var u=0;u<ckam[claskam].style.left.length;u++){ if(ckam[claskam].style.left[u]!="p"&&ckam[claskam].style.left[u]!="x"){ if(u!=0){ znach=znach+""+ckam[claskam].style.left[u]; } else{ znach=ckam[claskam].style.left[u]; } }} return znach; }
1 ответ
+ 3
What are you exactly trying to achieve? I quite cannot understand.
Also, instead of iterating over the string, you can parse it as int or float.
x = ckam[claskam].style.left;
// suppose x is "192.6px"
y = parseInt(x);
// now y is 192
z = parseFloat(x);
// now z is 192.6