Never mind, I found the answer 10 minutes after I posted this question. I feel like an idiot now ==;
I need to use new variable for array instead of "i", since it used for input element array.
var inputs=document.getElementsByTagName('input'),
total = 0,
price = new Array(),
qty = new Array(),
j = 0, k = 0;
for (var i = 0 ; i < inputs.length ; i++) {
if (inputs[i].id.indexOf('price-') == 0) {
price[j] = parseFloat(document.getElementById(inputs[i].id).value);
j++;
}
if (inputs[i].id.indexOf('qty-') == 0) {
qty[k] = parseInt(document.getElementById(inputs[i].id).value);
k++;
}
}
for (i = 0 ; i < price.length ; i++) {
total = total + price[i] * qty[i];
}
alert (total); //alert result: 48.9