Ask Experts Questions for FREE Help !
Ask
    Mitchman's Avatar
    Mitchman Posts: 1, Reputation: 1
    New Member
     
    #1

    Mar 4, 2009, 07:54 AM
    Try to make a make a simple Menu
    I am trying to make a simples meun but I don't know how it get it to add up the taxes.
    What I need it to do is when the user press the total up order button the appropriate subtotals, taxes and final total will be calculated and displayed.


    This is what I came up with so far. I hope someone can help me.


    <HTML>
    <HEAD>
    <TITLE>Take Out Menu Assignment</TITLE>

    <script type="text/javascript">


    // Start Total Up Order

    function FtoC(FTemp)
    { document.form1.hb.value = (FTemp) * 2.99;
    }

    function CtoF(CTemp)
    { document.form1.total.value = (CTemp * FTemp) * 2.99;
    }

    function AtoB(ETemp)
    { document.form1.cb.value = (ETemp) * 3.99;
    }

    function CtoD(DTemp)
    { document.form1.cbtotal.value = (DTemp * ETemp) * 3.99;
    }


    function EtoF(FTemp)
    { document.form1.chb.value = (FTemp) * 4.99;
    }

    function GtoH(GTemp)
    { document.form1.chbtotal.value = (GTemp * FTemp) * 4.99;
    }


    function ItoJ(HTemp)
    { document.form1.ff.value = (HTemp) * 2.99;
    }

    function LtoK(ITemp)
    { document.form1.fftotal.value = (ITemp * HTemp) * 2.99;
    }

    function MtoN(JTemp)
    { document.form1.gravy.value = (JTemp) * 0.50;
    }

    function OtoP(KTemp)
    { document.form1.gtotal.value = (KTemp * JTemp) * 0.50;
    }


    function QtoR(LTemp)
    {document.form1.chilli.value = (LTemp) * 1.99;
    }

    function StoT(MTemp)
    { document.form1.ctotal.value = (MTemp * LTemp) * 1.99;
    }


    function adder(){
    var x=document.getElementById("tb1").value
    var y=document.getElementById("tb2").value
    var z=document.getElementById("tb4").value
    var r=document.getElementById("tb5").value
    var q=document.getElementById("tb6").value
    var m=document.getElementById("tb7").value
    var b=document.getElementById("tb3").value
    var f=document.getElementById("tb8").value
    var g=document.getElementById("tb9").value
    var h=document.getElementById("tb10").value
    document.getElementById("tb3").value=parseFloat(x) +parseFloat(y)+parseFloat(z)+parseFloat(r)+parseFl oat(q)+parseFloat(m)

    document.getElementById("tb8").value=parseFloat(b) +parseFloat(f)
    document.getElementById("tb9").value=parseFloat(b) +parseFloat(g)
    document.getElementById("tb10").value=parseFloat(b )+parseFloat(f)+parseFloat(g)

    }


    // End Total Up Order

    </script>

    </HEAD>

    <BODY>

    <form name="form1">

    <table width="90%" >
    <tr>
    <td>
    <table>
    <th>item</th><th>price</th><th>quantity</th><th>sub-total</th>
    <tr align="center">
    <td align="left">Hamberger</td>

    <td><input type="text" value="$2.99" size="6" ></td>

    <td><input type = "text" name="total" value="0" size="3" onChange="FtoC(this.value)"></td>

    <td><input type="text" name="hb" value="0.00" id="tb1" size="6" onChange="CtoF(this.value)"></td>

    </tr>
    <tr align="center">
    <td align="left">Cheeseburger</td>

    <td><input type="text" value="$3.99" size="6" ></td>

    <td><input type = "text" name="cbtotal" value="0" size="3" onChange="AtoB(this.value)"></td>

    <td><input type="text" name="cb" value="0.00" id="tb2" size="6" onChange="CtoD(this.value)"></td>

    </tr>
    <tr align="center">
    <td align="left">Chicken Burger</td>

    <td><input type="text" value="$4.99" size="6" ></td>

    <td><input type = "text" name="chbtotal" value="0" size="3" onChange="EtoF(this.value)"></td>

    <td><input type="text" name="chb" value="0.00" id="tb4" size="6" onChange="GtoH(this.value)"></td>


    </tr>
    </table>
    </td>
    <td align="right">
    <table>
    <th>item</th><th>price</th><th>quantity</th><th>sub-total</th>
    <tr align="center">
    <td align="left">French Fries</td>

    <td><input type="text" value="$2.99" size="6" ></td>

    <td><input type = "text" name="fftotal" value="0" size="3" onChange="ItoJ(this.value)"></td>

    <td><input type="text" name="ff" value="0.00" id="tb5" size="6" onChange="LtoK(this.value)"></td>

    </tr>
    <tr align="center">
    <td align="left"><input type="checkbox"> gravy</td>

    <td><input type="text" value="$0.50" size="6" ></td>

    <td><input type = "text" name="gtotal" value="0" size="3" onChange="MtoN(this.value)"></td>

    <td><input type="text" name="gravy" value="0.00" id="tb6" size="6" onChange="OtoP(this.value)"></td>
    </tr>
    <tr align="center">
    <td align="left"><input type="checkbox"> chili</td>

    <td><input type="text" value="$1.99" size="6" ></td>

    <td><input type = "text" name="ctotal" value="0" size="3" onChange="QtoR(this.value)"></td>

    <td><input type="text" name="chilli" id="tb7" value="0.00" size="6" onChange="StoT(this.value)"></td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <table align="center">
    <tr>
    <td >subtotal</td>
    <td><input type="text" id="tb3" size="6"></td>
    </tr>
    <tr>
    <td >pst</td>
    <td><input type="text" value="5.00" id="tb8" size="6"></td>
    </tr>
    <td >gst</td>
    <td><input type="text" value="6.00" id="tb9" size="6"></td>
    </tr>
    <td >total</td>
    <td><input type="text" value="0.00" name="" id=" id=" size=" size="></td>
    </tr>
    <tr>
    <td colspan="></td>
    </tr>
    <tr>
    <td colspan=">
    <input type="button">
    <input type="total up order" value="st" id="adder()">
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>


    </form>

    </BODY>
    </HTML>

Check out some similar questions!

What move should I make? Or should I even make one? [ 9 Answers ]

I am a high school student. I play on our girl's varsity basketball team, and I have a bit of an interest/crush on a guy from the guy's team. Our practice and game times are normally in tandem. I see him there and occaisonally in school. Recently, I admitted my interest to a friend, and she said,...

How much do you make? [ 2 Answers ]

I'm seeking a career in underwater welding but iwould like to know how much I would be making starting?

Does this make since? [ 8 Answers ]

Hey... Well... Im 15. And my boyfriend is 18. Yes.. I know that sounds bad. Yes it makes him look desperate or whatever, but people don't understand. Age doesn't run everything. And this is going to sounds worse... He smokes and drinks, and he dropped out of school last year. BUT! He's getting...

How can I make my dog eat? [ 16 Answers ]

I have an almost 2 year old Great Pyrenees. Unfortunately, he's only 73 lbs. He's a very picky eater. Some days he'll eat all of his food. Some days he won't eat anything or he'll just pick at it. We've tried all types of foods. Dry, canned, mixed, with gravy. The only thing he does not have a...


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.