Thread View: aus.computers.java
2 messages
2 total messages
Started by Sarah Chancel
Sun, 07 May 2000 00:00
Price calculator?
Author: Sarah Chancel
Date: Sun, 07 May 2000 00:00
Date: Sun, 07 May 2000 00:00
9 lines
1037 bytes
1037 bytes
Hi, I'm looking for applet that'll calculate the price the client has to pay when ordering a certain amount of products on my site. I'm actually not sure if I'm supposed to look for an applet or use javascript... The program will have to give me the total amount due at the bottom of the page... I hope you understand what I mean, I'd really appreciate some help, Thanks, Sarah.
Re: Price calculator?
Author: Alan
Date: Sun, 07 May 2000 00:00
Date: Sun, 07 May 2000 00:00
49 lines
2231 bytes
2231 bytes
If they are choosing products in a page using a form then Javascript is
pobably the easiest way
you could use something like
function compute(f)
{
var f = document.pricing; // This is the form we'll we working with;
var count1 = parseInt(f.count1.value);
if (isNaN(count1)) { count1 = 0; f.count1.value = "0"; }
f.subt1.value = 3.4 * count1;
var count2 = parseInt(f.count2.value);
if (isNaN(count2)) { count2 = 0; f.count2.value = "0"; }
f.subt2.value = 3.4 * count2;
f.total.value = parseFloat(f.subt1.value) +
parseFloat(f.subt2.value)
}
<FORM NAME="pricing">
<INPUT TYPE=text NAME="count1" SIZE=12 onChange="compute()">of $3.40<INPUT
TYPE=text NAME="subt1" SIZE=12 onChange="compute()"><BR>
<INPUT TYPE=text NAME="count2" SIZE=12 onChange="compute()">of $3.40<INPUT
TYPE=text NAME="subt2" SIZE=12 onChange="compute()"><BR>
<INPUT TYPE=text NAME="total" SIZE=12 onChange="compute()">
</FORM>
do if you are not doing it in a form you could do some server side code
Alan
"Sarah Chancel" <schancel@club-internet.fr> wrote in message
news:8f3dsc$s5n$1@front3m.grolier.fr...
> Hi,
> I'm looking for applet that'll calculate the price the client has to pay
> when ordering a certain amount of products on my site. I'm actually not
sure
> if I'm supposed to look for an applet or use javascript...
> The program will have to give me the total amount due at the bottom of the
> page...
> I hope you understand what I mean, I'd really appreciate some help,
> Thanks,
> Sarah.
>
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads