[code=php]
<script type=”text/javascript”>
function CalcPercnt(val, f) {
//val: Percentage Field value
//f: form which percent1 is in
if (!val == “”){
f.amt1.value = (f.Cost.value * (val / 100 + 1)).toFixed(2)
}
}
</script>
I need to calculate profit and the amount in percentage(profit margin).The profit is in dollar ($).This code only calculate the amount =cost*percentage.Now,I hope someone can help me to change this codes and get the profit in ($).
The output of this codes is(example)::
Cost:………………. Percentage:………………. Amount:………………….
Cost:10 Percentage:5 Amount:10.5O
Now,i need a code that can give the output like this:
Cost:10 Percentage:5 Amount:10.5O Profit:$0.50