JavaScript - Para expertos - Agregar Fila

 
Vista:

Para expertos - Agregar Fila

Publicado por Sergio (3 intervenciones) el 23/01/2004 16:26:51
Amigos: quisiera saber si se puede insertar una fila dinamicamente. Es decir, tengo una tabla y un boton insertar fila;
se pude hacer que cuando le doy click al boton insertar fila me agregue una fila a mi tabla ?? (sin refrescar toda la pagina, por supesto).
Si alguien puede responderme, seria de mucha ayuda.

Gracias, Sergio.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Para expertos - Agregar Fila

Publicado por shfile (171 intervenciones) el 23/01/2004 19:06:43
Hola Sergio:

Espero que te sirva ese pequeño ejemplo:

<Script>
function Agregar() {
valor = "12345678 XXXXXXXXXAXXXXXXXXXAXXXXX XXXXXXXXXA DD-MM-AAAA DLL 999,999.99 999,999.99 999,999.99"
// Crear Renglon
row = document.createElement('<TR height="17" OnmouseOver="this.style.background=\'#FFFF00\';" OnmouseOut=this.style.background="transparent" Style="cursor:hand;">');
tbody.appendChild(row);
//Registro
col=document.createElement('<Td>');
row.appendChild(col);
//Armar Linea de Datos
col.innerHTML='<Input ReadOnly value="' + valor + '" type=text STYLE="height:15px;border:0;background:#transparent;width:653px;font-family:courier new;font-size:11px;cursor:hand;"></Td></Tr>';
}
</Script>
<Button onclick="Agregar();"> Agregar </Button>
<TABLE id=Detalle cellSpacing=0 cellPadding=0 border=1 Width="100%">
<TBODY>
</TBODY>
</TABLE>

<Script>
//Declarar Objecto de la Tabla Dinamica.
var tbody=Detalle.childNodes[0];
Detalle.appendChild(tbody);
</Script>

Suerte
ShFile (Mexico)
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar