Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function calculate();
- {
- var mugPrice = 5;
- var keyringPrice = 2;
- var tshirtPrice = 15;
- var numMug = document.getElementById('numberOfMugs').value
- var numTshirt = document.getElementById('numberOfTshirts').value
- var numKeyring = document.getElementById('numberOfKeyrings').value
- var totalpay = (numMug * mugPrice) + (numTshirt * tshirtPrice) + (numKeyring * keyringPrice);
- document.getElementById('totalPrice').value= totalpay;
- }
- <button class="calcButton" onclick="calculate()">Calculate Order</button
- <h3>Total price: <input type=text; id="totalPrice" disabled /> </h3>
Add Comment
Please, Sign In to add comment