Tengo una forma en HTML y JavaScript. Necesito por código asignar a cada renglón de una tabla, que tienen estatus 1, una subdirección mediante un combo (resuelta esta parte).
El problema es que requiero duplicar cualquier renglón usando un botón para que este mismo renglón duplicado (resuelto), tenga estatus 2 para poder diferenciarlos (parte no resuelta). Utilizo un hidden donde guardo el estatus y está incrustado en la columna de una tabla.
El problema es que no encuentro cómo referenciar el renglón donde oprimo el botón duplicar para cambiar su valor:
El botón llama a esta función JavaScript:
function duplica_numeral(nI,numeral_id,of_au_id,au_id){
//alert("Entro a duplicar numeral " );
var oTabla = document.getElementById("Tab_Numerales");
var nFilas = oTabla.rows.length;
var row = document.getElementById("numeral"+nI); // find row to copy
var clone = row.cloneNode(true); // copy children too
clone.id = "numeral"+nFilas; // change id or other attributes/contents
clone.getElementsByTagName('select')[0].id = "comboAtencion" + nFilas;
alert("Before change to c ( hidNumeral has value 'a' " ); // This line runs
clone.getElementById('hidNumeral').value = 'c'; // this line is incorrect, why ??
alert("after change to c " ); // This line does not run
}
Código HTML:
<table width="100%" border="0" cellpadding="0" id="Tab_Numerales" >
<tr height="25%" bgcolor="<?php echo $vcolor; ?>"
name="numeral<?echo$i;?>" id="numeral<?echo$i;?>">
<td align="center" class="rows"><?php echo $i; ?></td>
<td align="center" class="rows"><?php echo $row['numeral']; ?></td>
<td align="center" class="rows"><input name="hidNumeral" type="text" id="hidNumeral"
Quiero poner table hidnumeral
en estatus 2.