javascript - Outputting a calculation -


I have verified this script on the w3 validator and it is not valid with errors, but when I do something within the cart The output tries to calculate. I was wondering what the problem was.

  & lt; script type = text / javascript & gt; Function ShoppingCart () {var Karrata = 0.10; Var tax = 0; Var subtotal = 0; Var total = 0; Var quantity = document. GetElementById ("Quantity"). Values; Var price = document.getElementById ("Options"). Values; Subtotal = quantity * price; Tax = Subtotal * Taxrate; Total = subtotal + tax; Tax = tax.toFixed (2); SubType = SubTotal.toFixed (2); Total = total.toFixed (2); & Lt ;! - data back form - & gt; . Document.getElementById ('sub-totals') innerHTML = "sub-tot =" + sub-totals; document.getElementById ('totalTax') innerHTML = "Totaltax =" + tax + "(@ 10)". document.getElementById ('Total'). InnerHTML = "total =" + total; Alert ("checkotle")} & lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Script type = text / javascript & gt; & Lt; / Script & gt; & Lt; Form onsmubit = "shoppingcart ()" & gt; & Lt; H1 & gt; Shopping cart & lt; / H1> Choose option & lt; Select & gt; & Lt; Option value = "" & gt; Select & lt; / Option & gt; & Lt; Option value = "$ 20" & gt; Spin class $ 20 & lt; / Options & gt; Option value = "$ 40" & gt; "Swim lessons $ 40  gt; option value =" $ 10 "> Boxers $ 10  
Option value =" $ 5 "& gt; Protein shake $ 5 gt; & gt; Selection & gt; Label = "session"> Session: & lt; / label & gt; & lt; input type = "text" Name = "Quantity" size = "1" id = "session">
Battery

The elements you were trying to write do not appear in the section of HTML Your code

Some of them are not present at all and some have wrong cover < / P>

This is my guess for your estimate:

document element

document. GetElementById ('total tax') < / code> should be document.getElementById ('tax')

and

document. getElementById ('Total') should be document.getElementById ('Total')

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -