Quote (carteblanche @ Nov 12 2015 08:16pm)
ok, starting place. you know you need to display what the user has selected. the trigger i assume is when the user clicks the button. that means you'll need an event listener. which event sounds relevant?
here's a small list:
Code
onchange An HTML element has been changed
onclick The user clicks an HTML element
onmouseover The user moves the mouse over an HTML element
onmouseout The user moves the mouse away from an HTML element
onkeydown The user pushes a keyboard key
onload The browser has finished loading the page
an example of how to use it:
http://www.w3schools.com/js/js_events.asp function totalcost(){
var type;
var newline= "";
";
var sum=0.00;
var toppings="";
if( document.getElementById("small").checked==true){
type="Small Pizza";
sum+=10.00;
}
if( document.getElementById("medium").checked==true){
type="Medium Pizza";
sum+=12.00;
}
if( document.getElementById("large").checked==true){
type="Large Pizza";
sum+=16.00;
}
if( document.getElementById("pepperoni").checked==true){
toppings=toppings+"Pepperoni, ";
sum+=1.00;
}
if( document.getElementById("olives").checked==true){
toppings=toppings+"Olives, ";
sum+=0.50;
}
if( document.getElementById("sausage").checked==true){
toppings=toppings+"Sausage, ";
sum+=1.00;
}
if( document.getElementById("peppers").checked==true){
toppings=toppings+"Peppers, ";
sum+=0.50;
}
if( document.getElementById("onions").checked==true){
toppings=toppings+"Onions, ";
sum+=0.50;
}
I got this using the getElementById function.. and I'm using an onclick button now but I don't know how to make it display my choices and price where <th rowspan="10" id="outp"><h3>Order Details</h3>
<p id="outar"></p></th> this is.