este es el programa..
Código :
<html>
<head>
<meta charset="utf-8">
<style>
body {background-color: #e1e637;}
h1 {color: #ff090e;}
</style>
<script type="text/javascript">
function total() {
if (document.getElementsByName('principal').checked){
prin=12;
} else if (document.getElementsByName('principal').checked){
prin=20;
} else {
(document.getElementsByName('principal').checked)
prin=25;
}
}
</script>
<script>
function total2() {
if (document.getElementsByName('bebida').checked){
prin2=7;
} else if (document.getElementById('n5').checked){
prin2=4;
} else {
(document.getElementById('n6').checked)
prin2=5;
}
}
</script>
<script>
function total3() {
if (document.getElementsByName('postre').checked) {
prin3=7;
} else if (document.getElementById('n8').checked) {
prin3=5;
} else {
(document.getElementById('n9').checked)
prin3=9;
}
}
</script>
</head>
<body>
<h1> CAFETERIA </h1>
</script>
<p> SELECCIONE EL PLATO PRINCIPAL</p>
<input type="radio" id="n1" name="principal" value="12" > Caldo de pollo Q12.00 <br><br>
<input type="radio" id="n2" name="principal" value="20" > pescado frito Q20.00<br><br>
<input type="radio" id="n3" name="principal" value="25" > revolcado Q25.00<br><br>
<p> SELECCIONE SU BEBIDA</p>
<input type="radio" id="n4" name="bebida" value="7" > CocaCola Q7.OO<br><br>
<input type="radio" id="n5" name="bebida" value="4" > Jamaica Q4.00<br><br>
<input type="radio" id="n6" name="bebida" value="5" > Sprite Q5.00<br><br>
<p> SELECCIONE SU POSTRE</p>
<input type="radio" id="n7" name="postre" value="7" > Pastel de fresa Q7.oo<br><br>
<input type="radio" id="n8" name="postre" value="5" > Helado de Chocolate Q5<br><br>
<input type="radio" id="n9" name="postre" value="9" > Coctel de frutas Q9.00<br><br>
<input type="button" name="name" value="suma" onclick="Pluss();">
</form>
<script>
function Pluss()
{
var prin;
var prin2;
var prin3;
var result;
result=prin+prin2+prin3;
alert("la suma es:" +result);
}
</script>
</body>
</html> 