Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let btnSubmit = document.getElementById("submit");
- let allInputs = document.getElementsByTagName("input");
- for (let i = 0; i < allInputs.length; i++) {
- allInputs[i].addEventListener("change", displayCost);
- }
- function ticketPrice()
- {
- let choice = this.value;
- let ticketPrice = document.getElementById("ticketPrice");
- if (choice == "Phantom")
- {
- ticketPrice.innerHTML = "79"
- }
- if (choice == "Hamilton")
- {
- ticketPrice.innerHTML = "85"
- }
- if (choice == "Lion King")
- {
- ticketPrice.innerHTML = "67"
- }
- if (choice == "Miss Saigon")
- {
- ticketPrice.innerHTML = "83"
- }
- }
- function discountInput()
- {
- let displaydiscountInput = this.value;
- let seats = document.getElementById("seats");
- let discount = document.getElementById("discount");
- if (seats >=1 && seats <= 5) {
- discount.innerHTML = "0%";
- }
- else if (seats >= 6 && seats <= 9) {
- discount.innerHTML = "10%";
- }
- else if (seats >= 10) {
- discount.innerHTML = "15%";
- }
- }
- function displayCost() {
- var displayCostChoice = this.value;
- let deliveryCost = document.getElementById("deliveryCost");
- if (displayCostChoice == "e-ticket") {
- deliveryCost.innerHTML = "Free";
- }
- else if (displayCostChoice == "box_office") {
- deliveryCost.innerHTML = "£1.50";
- }
- else {
- deliveryCost.innerHTML = "£3.99";
- }
- }
- var basePrice = 0.00;
- $(".calculate").change(function(){
- newPrice = basePrice;
- $(".calculate option:selected").each(function() {
- newPrice +=$(this).data('price')
- });
- $("#ticketPrice").html(newPrice);
- });
- $(".totalPrices").change(function(){
- totalPrices = deliveryCostVar;
- $(".totalPrices option:selected").each(function() {
- totalPrices +=$(this).data('price')
- });
- $("#totalPrice").html(totalPrices);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement