Unit count + option pricing tool

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • E Lawrence
    New Member
    • Dec 2010
    • 1

    Unit count + option pricing tool

    Hello.. Im a super noob to Java but learning fast.

    I am tring to create a tool but I need to add an extra field to Increses the price depending on the number of paint coats desired.

    In other words, an imput field that if the number 1 is entered it gives one price, #2 gives a different and #3 gives a 3rd price.

    I created a script that displays all 3 results, but I rather have a field were you enter the number (1 2 or 3).

    Im not sure what to try in order to acomplish this.

    Anyone can help with this?

    Code:
    <script> 
    function count(val) { 
    val = val.split(" "); 
    document.form.op4.value = val 
    update_cost(val);
    update_cost_3(val);
    update_cost_5(val);
    } 
    function update_cost(val) { 
    var price = ""; 
    if (val<=15999){ price = "Invalid"; } 
    if (val>=16000 && val<=19999){ price = "$1,380"; } 
    if (val>=20000 && val<=24999){ price = "$1,897"; } 
    if (val>=25000 && val<=29999){ price = "$2,415"; } 
    if (val>=30000 && val<=34999){ price = "$2,955"; } 
    if (val>=35000 && val<=39999){ price = "$3,507"; } 
    if (val>=40000 && val<=44999){ price = "$4,140"; } 
    if (val>=45000 && val<=49999){ price = "$4,657"; } 
    if (val>=50000 && val<=54999){ price = "$5,175"; } 
    if (val>=55000 && val<=59999){ price = "$5,692"; } 
    if (val>=60000 && val<=69999){ price = "$6,210"; } 
    if (val>=70000 && val<=79999){ price = "$6,727"; } 
    if (val>=80000){ price = "$7,245"; } 
    document.form.op4.value = price; 
    }
    function update_cost_3(val) { 
    var price = "";
    if (val<=15999){ price = "Invalid"; } 
    if (val>=16000 && val<=19999){ price = "$1,518"; }
    if (val>=20000 && val<=24999){ price = "$2,087"; }
    if (val>=25000 && val<=29999){ price = "$2,656"; }
    if (val>=30000 && val<=34999){ price = "$3,251"; }
    if (val>=35000 && val<=39999){ price = "$3,858"; }
    if (val>=40000 && val<=44999){ price = "$4,554"; }
    if (val>=45000 && val<=49999){ price = "$5,123"; }
    if (val>=50000 && val<=54999){ price = "$5,692"; }
    if (val>=55000 && val<=59999){ price = "$6,261"; }
    if (val>=60000 && val<=69999){ price = "$6,831"; }
    if (val>=70000 && val<=79999){ price = "$7,400"; }
    if (val>=80000){ price = "$7,969"; }
    document.form.op5.value = price; 
    }
    function update_cost_5(val) { 
    var price = "";
    if (val<=15999){ price = "Invalid"; } 
    if (val>=16000 && val<=19999){ price = "$1,656"; }
    if (val>=20000 && val<=24999){ price = "$2,277"; }
    if (val>=25000 && val<=29999){ price = "$2,898"; }
    if (val>=30000 && val<=34999){ price = "$3,546"; }
    if (val>=35000 && val<=39999){ price = "$4,209"; }
    if (val>=40000 && val<=44999){ price = "$4,968"; }
    if (val>=45000 && val<=49999){ price = "$5,589"; }
    if (val>=50000 && val<=54999){ price = "$6,210"; }
    if (val>=55000 && val<=59999){ price = "$6,831"; }
    if (val>=60000 && val<=69999){ price = "$7,452"; }
    if (val>=70000 && val<=79999){ price = "$8,073"; }
    if (val>=80000){ price = "$8,694"; }
    document.form.op6.value = price;
    }
    </script> 
    <form name="form"><br>
    Unit amount:<br>
    <textarea onkeyup="count(this.innerHTML)" name="op31"></textarea><br>  
    Single Coat:<br> <input value="0" name="op4" /> <br>
    Double Coat:<br> <input value="0" name="op5" /> <br>
    Triple Coat:<br> <input value="0" name="op6" /> <br>
    </p>
    </form>
Working...