Possuo uma função que no evento onclik é disparado essa função (verificaChecked(obj)), onde tem a finalidade de criar dinamicamente um campo label e um input text. Está sendo criado normalmente, porem não estou conseguindo esconde-los.
A minha função é essa:
function verificaChecked(obj){
var var_Incremento = obj.getAttribute("id").substring(12);
//alert(var_Incremento);
var varCheckbox = document.getElementById('checkCliente' + var_Incremento).checked;
//var var_Incremento = obj.getAttribute("id").substring(9);
if (varCheckbox) {
//alert("Marcado a opção Cliente!");
var tbl = document.getElementById('AtChamado');
var lastRow = tbl.rows.length -1;
var iteration = lastRow;
var row = tbl.insertRow(lastRow);
var cellRightSel = row.insertCell(0);
var textNChamado = document.createTextNode("N° do Chamado");
var labelNChamado = document.createElement("label");
labelNChamado.id = 'textNChamado' + var_Incremento;
var quebraDesc = document.createElement('BR');
var el = document.createElement('input');
var quebra = document.createElement('BR');
el.type = 'text';
el.name = 'textNChamado' + var_Incremento;
el.id = 'textNChamado' + var_Incremento;
el.size = 20;
labelNChamado.appendChild(textNChamado);
cellRightSel.appendChild(labelNChamado);
cellRightSel.appendChild(quebraDesc);
cellRightSel.appendChild(el);
cellRightSel.appendChild(quebra);
return false;
} else {
var tbl = document.getElementById('AtChamado');
var lastRow = tbl.rows.length -1;
alert("LASTROW: " + lastRow);
//if (lastRow > 13) {
//tbl.deleteRow(lastRow - 1);
if (lastRow = 15) {
tbl.deleteRow(lastRow - 1);
//alert("Dentro do If");
}
//alert(document.form.checkCliente0.checked)
}
}
Pergunta
Martinsrj
Olá pessoal, boa tarde!
Possuo uma função que no evento onclik é disparado essa função (verificaChecked(obj)), onde tem a finalidade de criar dinamicamente um campo label e um input text. Está sendo criado normalmente, porem não estou conseguindo esconde-los.
A minha função é essa:
function verificaChecked(obj){ var var_Incremento = obj.getAttribute("id").substring(12); //alert(var_Incremento); var varCheckbox = document.getElementById('checkCliente' + var_Incremento).checked; //var var_Incremento = obj.getAttribute("id").substring(9); if (varCheckbox) { //alert("Marcado a opção Cliente!"); var tbl = document.getElementById('AtChamado'); var lastRow = tbl.rows.length -1; var iteration = lastRow; var row = tbl.insertRow(lastRow); var cellRightSel = row.insertCell(0); var textNChamado = document.createTextNode("N° do Chamado"); var labelNChamado = document.createElement("label"); labelNChamado.id = 'textNChamado' + var_Incremento; var quebraDesc = document.createElement('BR'); var el = document.createElement('input'); var quebra = document.createElement('BR'); el.type = 'text'; el.name = 'textNChamado' + var_Incremento; el.id = 'textNChamado' + var_Incremento; el.size = 20; labelNChamado.appendChild(textNChamado); cellRightSel.appendChild(labelNChamado); cellRightSel.appendChild(quebraDesc); cellRightSel.appendChild(el); cellRightSel.appendChild(quebra); return false; } else { var tbl = document.getElementById('AtChamado'); var lastRow = tbl.rows.length -1; alert("LASTROW: " + lastRow); //if (lastRow > 13) { //tbl.deleteRow(lastRow - 1); if (lastRow = 15) { tbl.deleteRow(lastRow - 1); //alert("Dentro do If"); } //alert(document.form.checkCliente0.checked) } }Desde já agradeço pela ajuda.
O meu código completo está no site Pastebin:
http://pastebin.com/HnHBdH81
Link para o comentário
Compartilhar em outros sites
2 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.