0
Ich habe diesen Code, an dem ich arbeite, aber die Schaltfläche Berechnen funktioniert nicht, egal was ich mache. Ich möchte die Kosten pro Quadratzoll mit der PizzaSize und PizzaCost finden. Wie kann ich den Berechnungsknopf berechnen lassen?Wie funktioniert das Berechnen der Schaltfläche?
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8' >
<title> Pizza Calculator </title>
<script src="pizzaCalc.js">
</script>
</head>
<body>
<h1>Pizza Calculator</h1>
<p>
<label for="priceBox">Cost: </label><input type="text" id="priceBox" size="5"/></p>
<p>
<label for="sizeBox">Diameter :</label><input type="text" id="sizeBox"
size="5"/>
</p>
<input type="button" id="cpsi" value="Cost PSI" onclick="calculate(cpsi)">
</body>
</html>
"use strict"
function pizzaCalc() {
var size = document.getElementById ("sizeBox").value;
size = parseFloat (size);
var price = document.getElementById("priceBox").value;
price = parceFloat (price);
var costPerSquareInch = price/(3.14 * (size/2)^2)
alert('Pizza value :' +costPerSquareInch);
document.getElementById("cpsi").value = costPerSquareInch;
}
wo ist der Code für 'pizzaCalc.js'? –
show js code wenn du Hilfe brauchst ansonsten theres keine Möglichkeit wir können dir helfen –
Ich sehe keinen Code. Es gibt nur HTML in der Frage. –