Created
December 19, 2011 03:41
-
-
Save anonymous/1495280 to your computer and use it in GitHub Desktop.
galamar - pastebin.com/MnRqKrry
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<title>Pizza To Go</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
</head> | |
<body> | |
<h1>Pizza To Go</h1> | |
<form id="f0"> | |
<strong>Choose Your Pizza</strong><br /> | |
<input type="radio" name="b" id="sm" value="8.00" onclick="pizzaTotal()"/>Small ($8.00)<br /> | |
<input type = "radio" name="b" id="md" value = "10.00" onclick="pizzaTotal()"/>Medium ($10.00)<br /> | |
<input type = "radio" name="b" id="lg" value = "12.00" onclick="pizzaTotal()"/>Large ($12.00)<br /> | |
<hr /> | |
<strong>Select Your Toppings</strong><br /> | |
<input type = "checkbox" id="mushrooms" value = ".50" />Mushrooms ($0.50)<br /> | |
<input type = "checkbox" id="pepperoni" value = "1.00" />Pepperoni ($1.00)<br /> | |
<input type = "checkbox" id="onions" value=".25"/>Onions ($0.25)<br /> | |
<input type = "checkbox" id="bacon" value="1.00"/>Bacon ($1.00)<br /> | |
<input type = "checkbox" id="ham" value="1.00" onclick="addToppings()"/>Ham ($1.00)<br /> | |
<input type = "checkbox" id="bell_peppers" value=".25" />Bell Peppers($0.25)<br /> | |
<input type = "checkbox" id="sausage" value = "1.00" />Sausage ($1.00)<br /> | |
<input type = "checkbox" id="extra_cheese" value = "1.00" />Extra Cheese ($1.00)<br /> | |
<input type = "checkbox" id="banana_peppers" value = ".25" />Banana Peppers ($0.25)<br /> | |
<br /> | |
Your total is:<input type="text" id="total" readonly> | |
</form> | |
<script type = "text/javascript"> | |
v0 = document.getElementById("total"); | |
v1 = document.getElementById("total"); | |
vsm = document.getElementById("sm"); | |
vmd = document.getElementById("md"); | |
vlg = document.getElementById("lg"); | |
small = document.getElementById("sm").value; | |
medium = document.getElementById("md").value; | |
large = document.getElementById("lg").value; | |
mushrooms = document.getElementById("mushrooms").value; | |
pepperoni = document.getElementById("pepperoni").value; | |
onions = document.getElementById("onions").value; | |
bacon = document.getElementById("bacon").value; | |
ham = document.getElementById("ham").value; | |
bell = document.getElementById("bell_peppers").value; | |
sausage = document.getElementById("sausage").value; | |
cheese = document.getElementById("extra_cheese").value; | |
banana = document.getElementById("banana_peppers").value; | |
smallTotal = small + mushrooms + pepperoni + onions + | |
bacon + ham + bell + sausage +cheese + banana; | |
mediumTotal = medium + mushrooms + pepperoni + onions + | |
bacon + ham + bell + sausage +cheese + banana; | |
largeTotal = large + mushrooms + pepperoni + onions + | |
bacon + ham + bell + sausage +cheese + banana; | |
function pizzaTotal() { | |
if (vsm.checked) { | |
return v1.value = small; | |
} | |
else if (vmd.checked) { | |
return v1.value = medium; | |
} | |
else if (vlg.checked) { | |
return v1.value = large; | |
} | |
} | |
function addToppings() { | |
if (ham.checked) { | |
return v1.value = ham + small; | |
} | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment