0
good morning, I want to do the following I have a table that hides the part I want but in java script I just hide what I want if I select the id of the part of the table but I want to do next when click on more or less it will decrease or increase without I need to select the id.
<html>
<body>
<script>
//Manipulando as linhas
function ocultaRow (rowIndex) {
var table = document.getElementById('tabela1');
table.rows[rowIndex].style.display = 'none';
}
function mostraRow (rowIndex) {
var table = document.getElementById('tabela1');
table.rows[rowIndex].style.display = '';
}
//Manipulando as colunas
function ocultaColumn (colIndex) {
var table = document.getElementById('tabela1');
for (var r = 0; r < table.rows.length; r++)
table.rows[r].cells[colIndex].style.display = 'none';
}
function mostraColumn (colIndex) {
var table = document.getElementById('tabela1');
for (var r = 0; r < table.rows.length; r++)
table.rows[r].cells[colIndex].style.display = '';
}
</SCRIPT>
<FORM>
Manipular Linhas
<SELECT NAME="rowIdx">
<script>
for (var i = 1; i <= 4; i++)
document.write('<OPTION VALUE="' + i + '">' + i);
</SCRIPT>
</SELECT>
<INPUT TYPE="button" VALUE="- " ONCLICK="ocultaRow(this.form.rowIdx.selectedIndex);">
<INPUT TYPE="button" VALUE="+" ONCLICK="mostraRow(this.form.rowIdx.selectedIndex);">
</FORM>
<FORM>
Manipular Colunas
<SELECT NAME="colIdx">
<script>
for (var i = 1; i <= 4; i++)
document.write('<OPTION VALUE="' + i + '">' + i);
</SCRIPT>
</SELECT>
<INPUT TYPE="button" VALUE="-" ONCLICK="ocultaColumn(this.form.colIdx.selectedIndex);">
<INPUT TYPE="button" VALUE="+" ONCLICK="mostraColumn(this.form.colIdx.selectedIndex);">
</FORM>
<table width="100%" border="1" id="tabela1">
<tr id="1">
<td>Linha1 coluna 1</td>
<td>Linha2 coluna 2</td>
<td>Linha3 coluna 3</td>
<td>Linha4 coluna 4</td>
</tr>
<tr id="2">
<td>nada2</td>
<td>LINHA 2</td>
<td>TESTE 2</td>
<td>TESTE 2</td>
</tr>
<tr id="3">
<td>nada3</td>
<td>LINHA 3</td>
<td>TESTE 3</td>
<td>TESTE 3</td>
</tr>
<tr id="4">
<td>nada4</td>
<td>LINHA 4</td>
<td>TESTE 4</td>
<td>ddd</td>
</tr>
<tr>
<td > 0</td>
<td>0</td>
<td>0</td>
<td>dd</td>
</tr>
</table>
</body>
</html>
What is the difference in functionality between the selects and the
+
and-
? I don’t really understand how they should work, or what they should do differently.– Sergio
i manipulate the column and table row the + to add row or column and the _ to decrease row or column the problem is that i n want to select manual wanted it to do that by clicking the more or less.
– gezer
But what is the relationship between select and these buttons? When you click on
+
it adds a line (at the end, in the middle or at the place that select indicates?)– Sergio
that even add anywhere in the table but n want it to be automatic 1 by one. but already tried and always error.
– gezer
I just got home and I can take another look here. Would you care to explain once again the functionality of each component? For example: change select must happen X by clicking on
+
should happen Y. See if it’s clear so I can help/respond.– Sergio
I managed to solve thanks friend. I’m terrible in terms rs
– gezer