Hi,
I'm new to javascript & working on PHP where in I have 15 rows & multiple columns
The below function is to calculate the row wise multiplication
The screen will look something like this:
stock price value
1) 12 4 48
2) 11 5 55
.
.
15) 10 6 60
-----
Total 163
The value is getting populated by the below function.
What I need is how can i incorporate the total i.e. 163 within this function.
----------------------------------------
function multopst() {
var opst = ['vops1','vops2','vops3','vops4','vops5','vops6','vops7','vops8','vops9','vops10','vops11','vops12' ,'vops13','vops14','vops15'];
var lprc = ['vlpr1','vlpr2','vlpr3', 'vlpr4', 'vlpr5', 'vlpr6', 'vlpr7', 'vlpr8', 'vlpr9', 'vlpr10', 'vlpr11', 'vlpr12', 'vlpr13', 'vlpr14', 'vlpr15'];
var opval = ['vvops1','vvops2','vvops3','vvops4','vvops5','vvops6','vvops7','vvops8','vvops9','vvops10','vvops11','vvops12','vvops13','vvops14','vvops15'];
for (var index = 0; index < opst.length; index++)
{
var myBox1 = document.getElementById(opst[index]).value;
var myBox2 = document.getElementById(lprc[index]).value;
var result = document.getElementById(opval[index]);
var val01 = myBox1 * myBox2;
result.value = val01;
};
};
----------------------------------------------------------------
TIA,
Raj
I'm new to javascript & working on PHP where in I have 15 rows & multiple columns
The below function is to calculate the row wise multiplication
The screen will look something like this:
stock price value
1) 12 4 48
2) 11 5 55
.
.
15) 10 6 60
-----
Total 163
The value is getting populated by the below function.
What I need is how can i incorporate the total i.e. 163 within this function.
----------------------------------------
function multopst() {
var opst = ['vops1','vops2','vops3','vops4','vops5','vops6','vops7','vops8','vops9','vops10','vops11','vops12' ,'vops13','vops14','vops15'];
var lprc = ['vlpr1','vlpr2','vlpr3', 'vlpr4', 'vlpr5', 'vlpr6', 'vlpr7', 'vlpr8', 'vlpr9', 'vlpr10', 'vlpr11', 'vlpr12', 'vlpr13', 'vlpr14', 'vlpr15'];
var opval = ['vvops1','vvops2','vvops3','vvops4','vvops5','vvops6','vvops7','vvops8','vvops9','vvops10','vvops11','vvops12','vvops13','vvops14','vvops15'];
for (var index = 0; index < opst.length; index++)
{
var myBox1 = document.getElementById(opst[index]).value;
var myBox2 = document.getElementById(lprc[index]).value;
var result = document.getElementById(opval[index]);
var val01 = myBox1 * myBox2;
result.value = val01;
};
};
----------------------------------------------------------------
TIA,
Raj