<html>
<head>
<title>Oefening - Pizza Bestellen</title>
<script language="JavaScript">
<!--
function bestel(){
alert ('uw pizza is besteld en wordt binnen 15 minuten warm afgeleverd!');
myWin.close();
// hier komt eventueel de uiteindelijke `bestel'-procedure:
// document.form1.submit()
}
function resultaat(form1){
var windowFeatures = 'width=400,height=400,scrollbar=no,status=no,toolbar=no';
var string1='<table border=1>';
for (i=0; i<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 + '].value') + '</td></tr>';
else
string1+='';
}
totaal=0
for (i=0; i<form1.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><input type="button" value="bestel" onClick="opener.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="parmezaanse kaas" name="pizza">Parmezaanse 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>
<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>
</table>
<br><br>
<input type="button" value="Bak mijn pizza !" onClick="resultaat(this.form)">
<input type="reset" value="herstel">
</form>
</body>
</html>