www.webdeveloper.com
Results 1 to 2 of 2

Thread: JavaScript calculator help

  1. #1
    Join Date
    Nov 2011
    Posts
    16

    JavaScript calculator help

    Hello,

    I am trying to make a JavaScript calculator form. I know there are some out there but they don't do exactly what I want to I am looking at doing my own.

    It is slightly more complicated than a normal one.

    Let's say I have items I want to sell. The customer can choose to customise an item and the calculator needs to work out the cost accordingly.

    So for example:

    • The items can be small, medium or large - each will have a base price
    • They can be 1 colour or 2 colours, each has a separate price
    • And the price per 100 depends on how many they buy. So for example if they buy 200 then it's 5.99 each. If they buy 500 then it's 5.50 each etc.


    What is best to do here?

    Should I be using arrays here or possibly storing in variables or using IF ELSE statements?

    Thanks for any help.

  2. #2
    Join Date
    Jun 2008
    Location
    Europe
    Posts
    1,096
    Play with some ideas in JSFiddle... it makes it easier...

    http://jsfiddle.net/QZSQX/


    ...Or perhaps there are already some libraries you can use with jQuery:
    http://keith-wood.name/calculator.html

    http://code.google.com/p/jquery-calculator/

    Plugin to download: http://www.pengoworks.com/workshop/j...ion.plugin.htm
    Last edited by donatello; 08-09-2012 at 04:16 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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



Recent Articles