Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

85 users online



anyone help with some JS coding?

anyone help with some JS coding?

Currently viewing this thread: 1 (0 members and 1 guests)


mic

mic

Status: Offline!

anyone help with some JS coding?

am terrible at this sort of thing...can anyone lend me a hand? the following takes quanity values inputted from a form and calculates the total cost based on the number they choose.

<script language = "JavaScript">

function calculatecost(form) {

// TAKE INPUTTED VALUES AND GIVE THEM VARIABLE NAMES

f1 = form.beef.value;
f2 = form.pork.value;
f3 = form.special.value;
f4 = form.young.value;
j1 = form.apple.value;
j2 = form.peach.value;
w1 = form.still.value;
w2 = form.spark.value;

// DO CALCULATION TO FIND COST WHERE VALUES F1 TO F4 ARE 3.20 EACH; VALUES AND J2 ARE 1.20 EACH AND VALUES W1 AND W2 ARE 0.80 EACH

COST = (3.20*(f1+f2+f3+f4) + 1.20*(j1+j2) + 0.80*(w1 + w2));

// IF TOTAL COST IS LESS THAN 10.00 THEN ADD ON 1.50 TO TOTAL COST

if cost<10.00 {cost = cost +1.50};

// RETURN TOTAL COST

form.totalcost.value = cost; return;

thanks.
mic.

mic

mic

Status: Offline!

pity the poor lad with no replies who has to reply to his own posts?

anybody help with this calculation???

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0066 seconds.