-1
I have a JSP with table with multiple rows and two columns. I have ten input lines where I want to play cell 0 and cell 1 in item1 and descr1 of the first input. By clicking on the next row of the table I want to play cell 0 and cell 1 in the item2 and in the descr2 of the second input and so on. Only that the same row of the table is being loaded in the first and second input or item1 descr1 and item2 and descr2.
{
linha = 1;
let tabela = document.getElementById("tabprd");
if(tabela != null)
{
for(let i = 0; i < tabela.rows.length; i++)
{
tabela.rows[i].onclick =
function()
{
if(linha === 1)
{alert("linha: " + linha);
document.getElementById("item1").value = this.cells[0].innerHTML;
document.getElementById("descr1").value = this.cells[1].innerHTML;
linha++;
}
if(linha === 2)
{alert("linha: " + linha);
document.getElementById("item2").value = this.cells[0].innerHTML;
document.getElementById("descr2").value = this.cells[1].innerHTML;
linha++;
}
};
}
}
}```
Esse é o javascript que uso para o load.
Atenciosamente,
Cezar Apulchro.