I am trying to create a page where there are two dropdown menus, and then when the user submits the press Depending on the data given from this dropdown menu, it needs to pick either 1 or 2 with the first dropdown menu preference, the second dropdown menu multiply by the value of the choice, multiply by 0.2 and when the user submits the press. I have tried to do this, but I continue with NAN errors. Any help?
& lt; Head & gt; & Lt; Script type = "text / javascript" & gt; Function value () {var sqBn = document.priceCalc.squareOrBanner; Var AMT = Documents. Occasion. Number; Var value = sqBn * AMT * 0.2; Document.write (value); } & Lt; / Script & gt; & Lt; Form name = "pricecalc" action = "priceCalcPage.html" onsubmit = "document.write (value)" & gt; & Lt; Div align = "center" & gt; & Lt; Select name = "squareoran" & gt; & Lt; Option value = "1" & gt; Square & lt; / Option & gt; & Lt; Option value = "2" & gt; Banner & lt; / Options & gt; & Lt; / Select & gt; & Lt; Select name = "number" & gt; & Lt; Option value = "250" & gt; 250 & lt; / Options & gt; & Lt; Option value = "500" & gt; 500 & lt; / Options & gt; & Lt; Option value = "750" & gt; 750 & lt; / Options & gt; & Lt; Option value = "1000" & gt; 1000 & lt; / Options & gt; & Lt; / Select & gt; & Lt; Br> & Lt; Input type = "submit" value = "shape pricing!" & Gt; & Lt; Br> & Lt; / Div & gt; & Lt; / Form & gt;
Maybe you are looking for something like this:
You need to access the value property in that object:
var price = sqBn.value * Amt.value * 0.2; Edit: This is a version that updates the value of the input box with the price: 2 Edit:
Comments
Post a Comment