jeudi 20 juin 2019

How to integrate JavaScript into a HTML page

I am trying to make an HTML website that sells pens, pencils and erasers. My issue is integrating the JavaScript into my HTML page. Everything has been working properly up until the last couple chunks of JavaScript any thoughts on how i could fix this problem.

Pens, Pencils and Erasers

  • HOME
Pens, Pencils and Erasers Pen $0.50 ADD TO CART Pencil $0.30 ADD TO CART Eraser $1.00 ADD TO CART CART

Saskatchewan

Alberta

Manitoba

ITEM PRICE QUANTITY Total $0

PURCHASE

if (document.readyState == 'loading') { document.addEventListener('DOMContentLoaded', ready) } else { ready() } function ready() { var removeCartItemButtons = document.getElementsByClassName('btn-danger') for (var i = 0; i ${title} ${price} REMOVE ` cartRow.innerHTML = cartRowContents cartItems.append(cartRow) cartRow.getElementsByClassName('btn-danger')[0].addEventListener('click', removeCartItem) cartRow.getElementsByClassName('cart-quantity-input')[0].addEventListener('change', quantityChanged) } function updateCartTotal() { var cartItemContainer = document.getElementsByClassName('cart-items')[0] var cartRows = cartItemContainer.getElementsByClassName('cart-row') var order_total = 0 for (var i = 0; i

I expect if Saskatchewan is chosen it should include a 5% tax onto the sales price and if they spend $30 they get $5 taken off. If Alberta is selected they would get $2 shipping added and 5% tax added onto the sales price. If Manitoba is selected they would get $2 shipping added and 6% tax added onto the sales price.

Aucun commentaire:

Enregistrer un commentaire