locked
In vbscript, RRS feed

  • Question

  • Help, need fixed, I need quantity to multiply with  totalcost,

    <script  language="vbscript">
       sub  calculate_onClick

         dim  totalCost, quantity

         quantity=CDbl(form1.quantity.value)

         if  form1.elements(0).checked = true then
            totalCost = (5 * quantity)
         elseif  form1.elements(1).checked = true then
            totalCost = (6 * quantity)
         else
            totalCost = (7 * quantity)
          end  if

         if  form1.elements(3).checked = true then
            totalCost = (totalCost * quantity)  + 1
         end  if

         if  form1.elements(4).checked = true then
            totalCost = (totalCost * quantity)  + 2
         end  if

        

         form1.total.value = formatCurrency(totalCost)
       end  sub
    </script>
    </head>

    <body>
    <form name="form1">
    <h2>Exam2-p1 </h2><br/>
    Quantity<br/>
    <input type = "text" name "quantity" value = " " />
    <br/><br/>

    Paper Color <br />
    <input type="radio" name="papercolor"  value="white" /> White <br />
    <input type="radio" name="papercolor"  value="yellow" /> Yellow <br />
    <input type="radio" name="papercolor"  value="blue"   /> Blue<br />

    <br />  <br />
    Extras <br />
    <input type="checkbox" name="extras"  value="cotton" /> 25% Cotton <br />
    <input type="checkbox" name="extras"  value="sealed" /> Sealed <br />

    <br />  <br />
    Total:  <input  type="text"  name="total" /> <br />
    <input  type="button"  name="calculate"  value="Calculate"  /> <br />
    <input type = "reset" Value = "Clear" />
    </form>

    Sunday, March 8, 2009 5:28 AM