Jason_14 0 Newbie Poster

I'm currently working on a for-fun-programming task. For some reason the "order now" button doesn't work. So I'm assuming it has something to do with the Array. (Fair warning I'm quite new to programming.)

So far this is all I have:

<html>
<script>
//global variables
var totalNumber = 0;   // for total number of Pizzas ordered
var pizzaPrice = 9.50;   // price of each pizza
var pizzaPriceGourmet = 15.50;  //price for gourmet pizzas
var pizzaDelivery = 5;  //price for pizza delivery
var orderTotalPrice = 0;   // total cost of order


var customername = prompt('Please enter your name.') //Function to take customers details, and to find out what order type it is
var ordertype = prompt('Is the order for delivery or pickup? - Note: Delivery will cost an extra $5.')
if (ordertype == 'pickup') {
 alert ("Place your order when you're ready.")
} else if (ordertype == 'delivery') {
 alert = prompt('Please enter your delivery address.')
 alert = prompt('Please enter your phone number.')
}

function order()
{
  var pizza = new Array()
  pizza[0] = document.form.hawaiian.value                //allocates type of pizza in array
  pizza[0] = Number(pizza[0])                            //converts to number value
  pizza[1] = document.form.cheese.value                 //allocates type of pizza in array            
  pizza[1] = Number(pizza[1])                            //converts to number value
  pizza[2] = document.form.veggie.value                //allocates type of pizza in array
  pizza[2] = Number(pizza[2])                            //converts to number value
  pizza[3] = document.form.supreme.value                //allocates type of pizza in array
  pizza[3] = Number(pizza[3])                            //converts to number value
  pizza[4] = document.form.pepperoni.value                //allocates type of pizza in array
  pizza[4] = Number(pizza[4])                            //converts to number value
  pizza[5] = document.form.meat-lovers.value                //allocates type of pizza in array
  pizza[5] = Number(pizza[5])                            //converts to number value
  pizza[6] = document.form.chicken.value                //allocates type of pizza in array
  pizza[6] = Number(pizza[6])                            //converts to number value
  pizza[7] = document.form.prawn.value                //allocates type of pizza in array
  pizza[7] = Number(pizza[7])                            //converts to number value

  totalNumber = pizza[0] + pizza[1] + pizza[2] + pizza[3] + pizza[4] + pizza[5] + pizza[6] + pizza [7];



 alert("You have ordered:" + "\n" +        
     "Hawaiian Pizza:" + pizza [0] + "\n" +
     "Cheese Pizza:" + pizza [1] + "\n" +
     "Veggie Pizza:" + pizza [2] + "\n" + 
     "Supreme Pizza:" + pizza [3] + "\n" +
     "Pepperoni Pizza:" + pizza [4] + "\n" +
     "Meat-Lovers Pizza:" + pizza [5] + "\n" +
     "Chicken Pizza:" + pizza [6] + "\n" +
     "Prawn Pizza:" + pizza [7]);

    alert("total number of pizzas ordered:" + totalNumber);
    }


    if (totalNumber >12) {          // Test for total amount of Pizzas ordered
    alert("There is a limit of 12 pizzas per order. Please cancel Order and re-order.");
    } else {
    alert ("Total number of pizzas ordered:" +totalNumber);  // Total number of pizzas Ordered
}

</script>

<body>
<h1> Welcome to Pete's Pizza! </h1>
<p> Please follow the prompts to place your order. </p>
<p> Menu: ($9.50) Hawaiian, Cheese, Veggie, supreme, pepperoni.</P>
<p> ($15.50) meat-lovers, chicken, prawn. </p>
<p> Please be aware that there is a $5 charge for deliveries. </p>

<form name ="form">
<input type="text" name= "hawaiian" > Hawaiian Pizza <br>
<input type="text" name= "cheese" > Cheese Pizza <br>
<input type="text" name= "veggie" > Veggie Pizza <br>
<input type="text" name= "supreme" > Supreme Pizza <br>
<input type="text" name= "pepperoni" > Pepperoni Pizza <br>
<input type="text" name= "meat lovers" > Meat-Lovers Pizza <br>
<input type="text" name= "chicken" > Chicken Pizza <br>
<input type="text" name= "prawn" > Prawn Pizza <br>

<input type="button" value="order now" onClick="order()">
<input type="button" value="cancel order" onClick="window.location.reload()">

</form>



<i> (Please note : Maximum 12 pizzas per Order ) </i>`
</body>
</html>

So if anyone knows what I have done wrong with my Array/webpage form, it would be greatly appreciated.