Can someone help me understand why the following code wont work? the webpage loads all the elements properly but the "displayOrder()" function wont execute properly. My webpage asks the user for their first name and last name, then there are 5 radio buttons asking for a pizza type, then the user presses a display order button, which on click runs the function. The function is suppose to display an "Invoice" in the readonly text area above the button. Im not sure why it wont run!
here is the html
REVISED HTML CODE
<!DOCTYPE html>
<html lang="en-US">
//Program Name: PizzaOrderForm.html
//Purpose: Creates a form and calls functions to order pizza
//Author: Alexander Bitar 50070103
//Date Last Modified: 02-25-2016
<head>
<script type="text/javascript">
var NL = "\n"; //newline js
//DISPLAY ORDER FUNCTION
function displayOrder() {
var firstName = document.orderForm.firstName.value;
var lastName = document.orderForm.lastName.value;
var pizzaType = document.orderForm.pType.value;
document.orderForm.fullOrder.value = "HERE IS YOUR ORDER:" + NL + NL
+"Pizza Ordered: " + pizzaType + NL
+"First Name: " + firstName + " Last Name: " + lastName + NL
+"You're pizza will be ready in 30 minutes!" + NL
+"Thank you for placing your order with Papa Hut's Pizza!";
}
</script>
</head>
<body bgcolor="azure">
<h1 Align="center"> Papa Hut's Pizza </h1>
<hr>
<br>
<br>
<p> Welcome to Papa Hut's Ordering system. Please Fill out the form to proceed with an order. </p>
<hr>
<br>
<br>
<form name="orderForm">
First Name:<br>
<input type="text" name="firstName"> <br>
Last name:<br>
<input type="text" name="lastName"><br>
Choose A Pizza<br>
<input type="radio" name="pType" value="Pepperoni"> Pepperoni <br>
<input type="radio" name="pType" value="Cheese"> Cheese<br>
<input type="radio" name="pType" value="Black Olive"> Black Olive <br>
<input type="radio" name="pType" value="Chicken Finger"> Chicken Finger <br>
<input type="radio" name="pType" value="TODAY'S SPECIAL"> TODAY'S SPECIAL<br>
<textarea name="fullOrder" value="" rows="5" cols="50"> Your order will appear here after it is sent!</textarea> <br>
<button type="displayButton" onclick="displayOrder()"> Place Order!</button>
</form>
</html>