I need to finish several assignments before Monday (You’re allowed to use any means nessesary so I’m not cheatin) and I can’t get this one to work.
The idea is that users can select several toppings before clicking ‘Bak mijn Pizza'(Bake my pizza), the program should than open a window contain a table with what they’ve ordered, a ‘bestel'(order) button an a ‘herstel'(reset button). After clicking ‘herstel’ users should see an alert saying their pizza wil be delivered within 15 minutes.
This is what I came up with: (this obvl. doesn’t work yet, please help me!)
[I]<!DOCTYPE html>
<html lang=”nl”>
<head>
<meta charset=”utf-8″>
<title>PO van Marleen Peeters</title>
<script language=”Javascript”>
function bestel(){<!–Deze functie opend een pop-up en sluit daarna het venster af–>
alert(“Uw pizza is besteld en wordt binnen 15 minuten warm afgeleverd!”);
myWin.close();
}
function resultaat(form1){
var windowFeatures=’width=400,height=400,scrollbar=no,status=no,tootbar=no’;
var string1='<table-border=1>’;
for(i=0;1<form1.pizza.length;i++){
if(form1.pizza[i].checked)
string1+='<tr><td>’ + form1.pizza[i].value + ‘</td><td width =”60” align=”right”>’+
eval(‘form1.bedrag[‘+i+i’].value’)+'</td></tr>’;}
else {
string1+=”;}
totaal=0
for (i=0;i<from1.pizza.length;i++) {
if (form1.pizza[i].checked){
if (form1.pizza[i].checked){
totaal+=parseFloat(form1.bedrag[i].value);}
eindbedrag=(Math.round(totaal*100)/100);}}
string2='<tr><td><b>Totaal:</b></td><td align=”right”><b>’ + eindbedrag + ‘</b></td></tr></table>’;
myWin=open(”,”, windowFeatures);
myWin.document.open();
myWin.document.write(‘<html><head><title> Pizzeria Staccatio </title></head><body>’);
myWin.document.write(‘<div> align=”center”><h3> U bestelde de volgende pizza :></h3>Basis plus:’);
myWin.document.write(string1);
myWin.document.write(string2);
myWin.document.write(‘<br><br><form><imput type=”button” value=”bestel” onclick=”open.bestel()”>’);
myWin.document.write(‘ <input type=”button” value=”herstel” onclick=”Self.close()”><hr width=”75%”>’);
myWin.document.write(‘</form></div></body></html>’);
myWin.document.close();}
</script>
</head>
<body>
<h2>Stel Uw eigen smulpizza samen!</h2>
<b>Basis plus de volgende extra ingredienten:<br></b>
<form name=”form1″>
<table>
<tr>
<td><input type=”checkbox” value=”tomaat” name=”pizza”>Tomaat</td>
<td>€ <input type=”text” value=”2.95″ name=”bedrag” onFocus=”blur()” size=5></td>
</tr>
<tr>
<td><input type=”checkbox” value=”Parmazaanse kaas” name=”pizza”>Parmazaanse kaas</td>
<td>€ <input type=”text” value=”2.00″ name=”bedrag” onFocus=”blur()” size=5></td>
</tr>
<tr>
<td><input type=”checkbox” value=”Gorgonzola” name=”pizza”>Gorgonzola</td>
<td>€ <input type=”text” value=”1.95″ name=”bedrag” onFocus=”blur()” size=5></td>
</tr>
<tr>
<td><input type=”checkbox” value=”Olijven” name=”pizza”>Olijven</td>
<td>€ <input type=”text” value=”2.50″ name=”bedrag” onFocus=”blur()” size=5></td>
</tr>
<tr>
<td><input type=”checkbox” value=”Ansjovis” name=”pizza”>Ansjovis</td>
<td>€ <input type=”text” value=”3.00″ name=”bedrag” onFocus=”blur()” size=5></td>
</tr>
<tr>
<td><input type=”checkbox” value=”Aardbeien” name=”pizza”>Aardbeien</td> <!–Op de pizza!?–>
<td>€ <input type=”text” value=”2.00″ name=”bedrag” onFocus=”blur()” size=5></td>
</tr>
<tr>
<td><input type=”checkbox” value=”Broccoli” name=”pizza”>Broccoli</td>
<td>€ <input type=”text” value=”1.99″ name=”bedrag” onFocus=”blur()” size=5></td>
</tr>
<tr>
<td><input type=”checkbox” value=”Asperges” name=”pizza”>Asperges</td>
<td>€ <input type=”text” value=”4.00″ name=”bedrag” onFocus=”blur()” size=5></td>
</tr>
<tr>
<td><input type=”checkbox” value=”Rode peper” name=”pizza”>Rode peper</td>
<td>€ <input type=”text” value=”1.00″ name=”bedrag” onFocus=”blur()” size=5></td>
</tr>
<tr>
<td><input type=”checkbox” value=”Groene peper” name=”pizza”>Groene peper</td>
<td>€ <input type=”text” value=”1.50″ name=”bedrag” onFocus=”blur()” size=5></td>
</tr>
<br>
<br>
<input type=”button” value=”Bak mijn pizza!” onClick=”resultaat(this.form)”>
<input type=”reset” value=”herstel”>
</form>
</body>
</html>
[/I]