Menu
Anybody able to offer any help…
[code=php]
function enterBook()
{
var myBooks = new Array()
var myPrices = new Array()
for (i = 1; i <= 5; i++)
{
myBooks[i] = prompt(“Enter title of book”,””);
myPrices[i] = parseFloat(prompt(“Enter price of book”,””));
document.getElementById(“output”).innerHTML += i + “. ” + myBooks[i] + “. Price: £” + myPrices[i] + “<br />”;
}
for (var i in myPrices)
{
document.getElementById(“total”).innerHTML =+ i;
}
}
I need to calculate the total of the myPrices array values using the ‘for in’ loop and display them to my page, i think im pretty close ?
Thanks!