how to multiply given numbers

Asked By fitz
30-Aug-10 09:50 PM
Earn up to 0 extra points for answering this tough question.
hello, can u help me in my assign.. i have problem solving this kind of program.. if you can help me, kindly reply.
kindly run it on html... the total must be qty*7.50... and so on for other ITEMS.. THx
<html>
<head>
      <title>ShopWee</title>
      <script language="javascript">    

      </script>
  </head>

<body>
    Qty&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
    Item&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
    Unitprice&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
    Total<br>
    <input type="text" size = "2" id="value1" name="value1" value=""/>
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp; ballpen
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp; 7.50
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp; <input type="text" size="2"/><br><br>

    
    <input type="text" size = "2" id="value1" name="value1" value=""/>
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp; pencil
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp; 4.75
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp; <input type="text" size="2"/><br><br>

    <input type="text" size = "2" id="value1" name="value1" value=""/>
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp; yellow paper
    &nbsp;0.90
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp; <input type="text" size="2"/><br><br>

    <input type="text" size = "2" id="value1" name="value1" value=""/>
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp; notebook
    &nbsp&nbsp&nbsp&nbsp&nbsp; 25.25
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp; <input type="text" size="2"/><br><br>

    <input type="button" name="Sumbit" value="Compute">
     &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp; Grand Total
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;<input type="text" size="2"/><br><br>

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp; Amount Tendered
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;<input type="text" size="2"/><br><br>


    
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp; Change
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;<input type="text" size="2"/>




</body>
</html>

  re: how to multiply given numbers

sri sri replied to fitz
30-Aug-10 11:14 PM
hi,

try the below code

Product 1 <input type="text" id="qty1" name="qty1" ><input type="text" id="Price1" name="Price1" value="7.50">
<input type="text" id="tot1" name="tot1">

Product 2 <input type="text" id="qty2" name="qty2" ><input type="text" id="Price2" name="Price2" value="10.50">
<input type="text" id="tot2" name="tot1">

<input type="button" onclick="calculate();" value="ok">

<script language="javascript">
function calculate()
{
    document.getElementById("tot1").value = document.getElementById("qty1").value * document.getElementById("Price1").value;
    document.getElementById("tot2").value = document.getElementById("qty2").value * document.getElementById("Price2").value;
}

  re: how to multiply given numbers

Mash B replied to fitz
31-Aug-10 01:47 AM
You can do this like this.
 
function MultiplyTwoNumber()
{
var a=document.getElementById(<controlId>).value;
var b=document.getElementById(<controlId>).value;
 
var c = parseFloat(a) * parseFloat(b) ;
 
document.getElementById(<labelcontrolid>).value = c;
 
}
 
Call this from button control.
<asp:Button OnClientClick="return MultiplyTwoNumber();" Text="Multiply" runat="server" />
Create New Account