Results 1 to 3 of 3

Thread: instant price quote calculator

  1. #1
    Join Date
    Jan 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default instant price quote calculator

    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 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 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
    BD

  2. #2
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,891
    Thanks
    2
    Thanked 441 Times in 435 Posts

    Default

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <script language="JavaScript" type="text/javascript">
    /*<![CDATA[*/
    
    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++){
      ip=frm[args[z0]];
      ip.value=ip.value.replace(/\D/g,'');
      values.push([ip.value,ip.parentNode.className]);
     }
     if (values[0][0].length>0){
      nu=values[0][0];
      tot=nu*values[0][1];
      for (var z1=1;z1<values.length;z1++){
       if (values[z1][0]){
        tot+=values[z1][0]*values[z1][1]*nu
       }
      }
     }
     frm[args[args.length-1]].value='$'+tot;
    }
    /*]]>*/
    </script></head>
    
    <body>
    <form>
    "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" />
    </form>
    </body>
    
    </html>
    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  3. #3
    Join Date
    Jan 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.
    BD

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •