Ciao a tutti/e,
ho bisogno di un grande aiuto perchè sto veramente uscendo di "melone"![]()
Riporto qui di seguito il codice e in più vi allego il print screen della tabella risultato....io in pratica devo, cliccando un tasto Canc qualsiasi, cancellare la riga corrispondente!!
function aggiungi(){
var valore=0;
if (document.createElement && document.getElementsByTagName) { // controllo accesso alle funzionalità DOM
tabella=document.createElement('TABLE');
corpotab=document.createElement('TBODY');
corpo=document.getElementById("tasti").parentNode;
riga=document.createElement('TR');
cella=document.createElement('TD');
// num_difetti=document.getElementById("num_dif");
valore1=document.inserisci.numdif.value;
++valore1;
valore=valore1+1;
document.inserisci.numdif.value=valore1;
voce=document.getElementById("qta");
voceclone=voce.cloneNode(true);
nome1='a'+valore;
voceclone.firstChild.firstChild.firstChild.firstCh ild.firstChild.firstChild.setAttribute("value",0);
voceclone.firstChild.firstChild.firstChild.firstCh ild.firstChild.firstChild.setAttribute("name",nome 1);
riga.appendChild(voceclone);
voce=document.getElementById("d1l");
voceclone=voce.cloneNode(true);
nome2='b'+valore;
voceclone.firstChild.firstChild.firstChild.firstCh ild.firstChild.firstChild.setAttribute("name",nome 2);
riga.appendChild(voceclone);
voce=document.getElementById("d2l");
voceclone=voce.cloneNode(true);
nome3='c'+valore;
voceclone.firstChild.firstChild.firstChild.firstCh ild.firstChild.firstChild.setAttribute("name",nome 3);
riga.appendChild(voceclone);
voce=document.getElementById("rot");
voceclone=voce.cloneNode(true);
nome4='d'+valore;
voceclone.firstChild.firstChild.firstChild.firstCh ild.firstChild.setAttribute("name",nome4);
riga.appendChild(voceclone);
voce=document.getElementById("tasti");
voceclone=voce.cloneNode(true);
nome5=valore;
voceclone.firstChild.firstChild.firstChild.firstCh ild.nextSibling.firstChild.setAttribute("name",nom e5);
riga.appendChild(voceclone);
corpo.appendChild(riga);
}
}
function cancella(nome)
{
corpo=document.getElementById("modello");
}
<TABLE id=tab_som>
<TR>
<TH><TABLE>
<TR><TD>Quantità</TD></TR>
</TABLE>
</TH>
<TH><TABLE>
<TR><TD>Difetto 1L</TD></TR>
</TABLE>
</TH>
<TH><TABLE>
<TR><TD>Difetto 2L</TD></TR>
</TABLE>
</TH>
<TH><TABLE>
<TR><TD>Rottamato</TD></TR>
</TABLE>
</TH>
<TH><TABLE>
<TR><TD>Inserisci/Cancella</TD></TR>
</TABLE>
</TH>
</TR>
<TR id=modello >
<TD id=qta>
<TABLE>
<TR><TD>
<INPUT ..........................>
</TD></TR></TABLE>
</TD>
<TD id=d1l>
<TABLE><TR><TD>
<drop down menu ..................> </TD></TR></TABLE>
</TD>
<TD id=d2l>
<TABLE><TR><TD>
<drop down menu ...................> </TD></TR></TABLE>
</TD>
<TD id=rot>
<TABLE>
<TR><TD>
<INPUT tabindex=17 type="Checkbox" name="d1" value=true>
</TD></TR></TABLE>
</TD>
<TD id=tasti>
<TABLE>
<TR><TD>
<input tabindex=18 type = "button" value ="Inser" onClick="aggiungi()">
</TD>
<TD>
<input tabindex=19 type="button" value ="Canc" name="1" onClick="cancella(this.name)">
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>

Rispondi quotando