View Full Version : instant price quote calculator

01-20-2011, 05:14 AM
Hi there,

I am trying to come up with an instant price quote calculator in javascript.

it would be a simple one with only three fields:
"label" -Number of Shirts
"label" -Number of Colors on Front
"label" -Number of Colors on Back

"button" calculate total

"results" total: $xx per bag: $xx

total price would decrease based on the number of shirts (more volume) / increase based on the number of colors both front and back.

something i found online that is 100% what i want: http://zeustees.com/about-us

i've found something here (http://javascript.internet.com/math-related/best-price.html) that will deal with the increase/decrease of volume and corresponding price but if anybody has a solution already, that would save me a lot of time and agony.

i am obviously not asking anyone to work for free but if someone could point me to a semblance of a solution, some code, something online that i could modify etc. i would love to learn javascript in the process and ideally come up with a working version of the calculator.

i tried to work with the .js from that website (http://zeustees.com/about-us) but it calls in some qq2.php page. so i haven't been able to replicate the solution. plus, i would assume that their price structure would be different than mine.

thank you in advance for your help

01-20-2011, 03:15 PM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<script language="JavaScript" type="text/javascript">

function Cal(obj){
var args=Cal.arguments,frm=args[0].form,nu,tot=0;
var values=[];
for (var ip,z0=1;z0<args.length-1;z0++){
if (values[0][0].length>0){
for (var z1=1;z1<values.length;z1++){
if (values[z1][0]){

"label" -Number of Shirts<span class="10" ><input name="number" size="5"/></span><br />
"label" -Number of Colors on Front<span class="10" ><input name="front" size="5" /></span><br />
"label" -Number of Colors on Back<span class="12" ><input name="back" size="5" /><br />
<input type="button" name="" value="Calculate" onmouseup="Cal(this,'number','front','back','total');" />
<input name="total" />


01-21-2011, 06:17 AM
wow!! thanks a million Vic!!

this is sure going to help me a bunch. i'm now gonna try to add the increase/decrease volume price thing and maybe a constant (like set up cost etc)...

this should be within my skill range, i think... i hope...

i'll post the whole thing once done.
thanks again for your help.