Print Page | Close Window

asp or javascript calculator?

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=896
Printed Date: 29 March 2026 at 6:48am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: asp or javascript calculator?
Posted By: billd3
Subject: asp or javascript calculator?
Date Posted: 10 March 2003 at 1:57pm

Greetings, all.

I've done a fair bit of looking around and from the sites and code I see here, this is the place to ask this.
I've been rebuilding my wife's site and she keeps getting the same question asked over and over and I thought that I had a clever idea - let them answer it themselves on her web site. They ask what she charges for her quilting services. She uses a simple formula:
Width A x Lenght B = C
C / 1296 = D (square yards)
D x $13 = charge (then of course we'd add the gov's share of taxes)
So, how hard would it be to put a quilting calculator on her site?
I've done a fair bit of VB scripting to automate software installs, AV updates and automated a lot of file server things with VBS, but that was long ago, and I've not done anything of this nature - I know there would need to be user input - the length in inches and the width in inches, then the script would run the formula and give them the results.

Thoughts???

Thanks,

Bill



-------------
BillD
http://theamcpages.com
http://theamcforum.com



Replies:
Posted By: michael
Date Posted: 10 March 2003 at 2:45pm
Well I am sure you want to have as little impact as possible for that so I think javascript would be the answer for you. This way you can have an immdiate result  without having the customer to hit a submit button or so. This calculator should be coming pretty close to what you want, so you would just have to adjust it to your formula http://www.scriptsearch.com/cgi-bin/jump.cgi?ID=7293 - http://www.scriptsearch.com/cgi-bin/jump.cgi?ID=7293


Posted By: billd3
Date Posted: 11 March 2003 at 10:24pm

OK, I've come up with something and made some mods to make it REALLY close, however, I can't seem to figure out how to make it round to 2 decimal spots, as in money/cash/currency/dollars, etc.

It was giving out to about 8 places, I needed only .xx but comprimised by forcing it to round up. I'd like to make it actual dollars and cents (sorry to our U.K. friends, I only know U.S. money, not Pounds, etc.)
I'd like to remove the math.ceil part and make it round to xx.xx or just two spots past the dot.
Here's the code......
In the head, I have:
<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
function a_times_b(form) {
a=eval(form.a.value)
b=eval(form.b.value)
c=((a*b)/1296)*13
c=Math.ceil(c)
form.ans.value=c
}
// End -->
    </SCRIPT>
-----------
and in the body, the form:
<FORM name="formx">
<p align="left"><font face="Verdana" size="2"><b>Machine quilting  available.</b> <a name="quiltcalc"></a></font>
<font face="Verdana"><font size="2"></b><br>Enter length in inches here:</font>
</font>
<input type="number" size=4 value=84 name="a"></font><font size="2" face="Verdana"><br>
Enter width in inches here:&nbsp; </font>
<font face="Verdana">
<input type="number" size=4 value=75 name="b"></font><font size="2" face="Verdana"><br>
Click to calculate:
</font>
<font face="Verdana">
<input type="button" value="  Go  " onClick="a_times_b(this.form)"></font><font size="2" face="Verdana"> $ </font>
<font face="Verdana"><input type "number" value=0 name="ans" size=5><font size="2"><br>
</font>
<font size="1">Approx cost to quilt rounded to closest dollar.
<font color="#FF0000"><b>Minimum charge $40.00</b></font></font><font size="2"><br> </font>
<font size="1">(Batting and tax (if applicable) extra.) </font><font size="2">
<br>
</font></font></font><font face="Verdana" size="1">Email or call for details.</font></p>
</FORM>



-------------
BillD
http://theamcpages.com
http://theamcforum.com



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net