PDA

View Full Version : How to do a x5 sum with javascript



GoldenMerc
27-05-2010, 02:45 PM
Well im trying to make a free kart system just to learn javascript and iv got most of it done other than the sums of like buying more than one of a item?
So how would i go about multiplying a item ?
Ross

LMS16
27-05-2010, 03:55 PM
<SCRIPT Language = JavaScript>
howMuch=5
itemQuant=1
total = itemQuant*howMuch
alert(total)
</SCRIPT>

Something along those lines. Im not too good with js but i tried lol :)

Lew.

Apolva
27-05-2010, 10:13 PM
You'd use the * operator (which is pretty much the same in any language)

Here's a list of operators: http://www.w3schools.com/js/js_operators.asp

Note to Lew: The "language" attribute is deprecated, use "type" instead, eg. <script type="text/javascript">

Want to hide these adverts? Register an account for free!