PDA

View Full Version : How can i have HTML perform additions and subtractions


ideavirus
10-04-2004, 03:32 PM
Hi,

How can i get or code HTML to do some mathematical processes liek addition and/or subtraction ... like say...

I want this to happen ...

Shipping+handling-discount = Total

How cani get HTMl to do this, what is teh code to this kind of stuff.

Thanks for your help.

Cheers

scoutt
10-04-2004, 04:07 PM
in short, you can't.

you need javascript so I will move this to the client side forum.

ideavirus
10-04-2004, 04:50 PM
Can someone help me with that javascript code or atleast give me a web-pointer, where i can get the code to do the same.

Thanks for your valuable time
Cheers

Kram
10-04-2004, 10:17 PM
well you would need to do it javascript as said before. DO you know anything at all about javascript?

heres the basics behind it

<script type="javascript">
var shipping = 50;
var handling = 30;
var discount = 10;

total = shipping + handling - discount;
</scrip>


but the problem is filling these values with different values, how are you doing your page?

You will need to replace "= 50"
with "= [some argument]" where [some argument] means some kind of code that retrieved the correct price.