[Javascript] Math
staeger
staeger at arch.ethz.ch
Thu Aug 16 11:15:39 CDT 2001
Cutter Bl wrote:
>
> I'm terrible at Math as it is, but I still don't understand javascripts math
> operations real well anyway. Any help here is greatly appreciated.
>
> I've got a non-profit who wants to sell Raffle Tickets from their site. I
> have a form text field where the user can enter the Quantity
> (myForm.Quantity). Here's the kicker. The client says $2 a ticket, 3 for $5.
>
> Ok, so 10 tickets is $17. 10 divided by three is 3.33333etc. 3 times 5 is
> 15, plus the $2 for the other ticket.
>
> But how do you put this in a script calculation?
>
> Cutter
> http://www.falcon-knives.com
i'm just trying it ...
var tickets = [number off tickets];
price = 5*Math.floor(tickets/3) + 2*(tickets%3);
greets./
--
-----------------------------------------------------------------
benjamin staeger swiss federal institute of technology
architecture & caad
mailto:staeger at arch.ethz.ch
http://caad.arch.ethz.ch/~staeger
-----------------------------------------------------------------
Always listen to experts.
They'll tell you what can't be done, and why. Then do it.
More information about the Javascript
mailing list