turtle3550
MIS
Hi javascript gurus,
How can I make it so that "function calculate()", "cost", "qty" and "value" become...
calculate1(), cost1, qty1, value1
calculate2(), cost2, qty2, value2...etc?
<script language="JavaScript">
for (i = 0; i <= 10; i++)
function [red]calculate[/red]()
{
var a = document.MyForm.[red]cost[/red].value;
var b = document.MyForm.[red]qty[/red].value;
var result = eval(a) * eval(b);
document.MyForm.total.[red]value[/red] = result;
}
</script>
How can I make it so that "function calculate()", "cost", "qty" and "value" become...
calculate1(), cost1, qty1, value1
calculate2(), cost2, qty2, value2...etc?
<script language="JavaScript">
for (i = 0; i <= 10; i++)
function [red]calculate[/red]()
{
var a = document.MyForm.[red]cost[/red].value;
var b = document.MyForm.[red]qty[/red].value;
var result = eval(a) * eval(b);
document.MyForm.total.[red]value[/red] = result;
}
</script>