simple cost totalling function - simple person


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: simple cost totalling function - simple person

  1. #1
    Join Date
    Nov 2005
    Posts
    2

    Exclamation simple cost totalling function - simple person

    please help me!!! i cant get this to work:
    script...



    <head>
    <title></title>

    <script>
    function totalCost()
    {
    450x450cost = 55.00 * eval("document.order.450x450.value")
    450x600cost = 57.00 * eval("document.order.450x600.value")
    450x750cost = 58.00 * eval("document.order.450x750.value")
    450x900cost = 60.00 * eval("document.order.450x900.value")
    450x1050cost = 62.00 * eval("document.order.450x1050.value")
    450x1200cost = 64.00 * eval("document.order.450x1200.value")
    450x1350cost = 66.00 * eval("document.order.450x1350.value")
    450x1500cost = 67.00 * eval("document.order.450x1500.value")
    450x1650cost = 86.00 * eval("document.order.450x1650.value")
    450x1800cost = 89.00 * eval("document.order.450x1800.value")
    450x1950cost = 92.00 * eval("document.order.450x1950.value")
    450x2100cost = 95.00 * eval("document.order.450x2100.value")
    450x2250cost = 99.00 * eval("document.order.450x2250.value")
    450x2400cost = 102.00 * eval("document.order.450x2400.value")
    450x2550cost = 105.00 * eval("document.order.450x2550.value")
    450x2700cost = 108.00 * eval("document.order.450x2700.value")
    450x2850cost = 111.00 * eval("document.order.450x2850.value")
    450x3000cost = 115.00 * eval("document.order.450x3000.value")
    450x3150cost = 119.00 * eval("document.order.450x3150.value")
    450x3300cost = 121.00 * eval("document.order.450x3300.value")
    450x3450cost = 125.00 * eval("document.order.450x3450.value")

    total = 450x450cost + 450x600cost + 450x750cost + 450x900cost + 450x1050cost + 450x1200cost + 450x1350cost + 450x1500cost + 450x1650cost + 450x1800cost + 450x1950cost + 450x2100cost + 450x2250cost + 450x2400cost + 450x2550cost + 450x2700cost + 450x2850cost + 450x3000cost + 450x3150cost + 450x3300cost + 450x3450cost
    document.order.cost.value = total
    }
    </script>
    </head>


    and the form that uses it.....



    <form name = order method = post action=mailto:*****>

    <p>450x450:<input name=450x450 size=5 maxlength=5><br>
    <p>450x600:<input name=450x600 size=5 maxlength=5><br>
    <p>450x750:<input name=450x750 size=5 maxlength=5><br>
    <p>450x900:<input name=450x900 size=5 maxlength=5><br>
    <p>450x1050:<input name=450x1050 size=5 maxlength=5><br>
    <p>450x1200:<input name=450x1200 size=5 maxlength=5><br>
    <p>450x1350:<input name=450x1350 size=5 maxlength=5><br>
    <p>450x1500:<input name=450x1500 size=5 maxlength=5><br>
    <p>450x1650:<input name=450x1650 size=5 maxlength=5><br>
    <p>450x1800:<input name=450x1800 size=5 maxlength=5><br>
    <p>450x1950:<input name=450x1950 size=5 maxlength=5><br>
    <p>450x2100:<input name=450x2100 size=5 maxlength=5><br>
    <p>450x2250:<input name=450x2250 size=5 maxlength=5><br>
    <p>450x2400:<input name=450x2400 size=5 maxlength=5><br>
    <p>450x2550:<input name=450x2550 size=5 maxlength=5><br>
    <p>450x2700:<input name=450x2700 size=5 maxlength=5><br>
    <p>450x2850:<input name=450x2850 size=5 maxlength=5><br>
    <p>450x3000:<input name=450x3000 size=5 maxlength=5><br>
    <p>450x3150:<input name=450x3150 size=5 maxlength=5><br>
    <p>450x3300:<input name=450x3300 size=5 maxlength=5><br>
    <p>450x3450:<input name=450x3450 size=5 maxlength=5><br>

    <p><button type =button onClick ="totalCost()">calculate order</button>
    <p>Total cost: <input type = text name = cost size = 10>

    <p>requirements/colours:
    <p><textarea name=comments cols=60 rows=4></textarea>
    <p><button type=submit>submit</button>
    <button type=reset>reset form</button>
    </form>


    Anyone who can help please do before i go completely insane
    thankyou

  2. #2
    Join Date
    Nov 2005
    Posts
    2
    anyone feel like helping??? the error message i keep getting is line 8 char 4 ; expected. i know this is java script but please dont discriminate.

Similar Threads

  1. call function for button
    By angela_quests in forum VB Classic
    Replies: 2
    Last Post: 04-13-2007, 04:57 AM
  2. comparing function pointers [was: typedef problem]
    By swapnil_paranja in forum C++
    Replies: 20
    Last Post: 08-25-2005, 03:54 PM
  3. Replies: 8
    Last Post: 03-08-2003, 06:25 PM
  4. help with a simple API function
    By Eduardo A. Morcillo in forum VB Classic
    Replies: 2
    Last Post: 04-24-2002, 09:27 AM
  5. I am helpless - Edit Info form
    By Dan in forum VB Classic
    Replies: 0
    Last Post: 03-17-2000, 05:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center