Ver Mensaje Individual
  #26 (permalink)  
Antiguo 12/09/2005, 09:02
Avatar de onlykfk
onlykfk
 
Fecha de Ingreso: agosto-2005
Ubicación: 20°45' Latitud Norte 100°
Mensajes: 121
Antigüedad: 18 años, 8 meses
Puntos: 1
Tu página de llamada...
<html>
<head>
<script language=javascript>
function redibujaTabla(datos){
var arrCols, nRow = document.all.mytabla.rows.length;
datos = datos.substring(0,datos.length); //Para kitarle el ultimo pipe
arrRengDatos = datos.split("|");

if(arrRengDatos.length<=0) { return; }
//Insertas el nuevo renglon
document.all.mytabla.insertRow(nRow);
//Lees el ultimo registro agregado
arrCols = arrRengDatos[arrRengDatos.length-1].split(";");
//Agregas las columnas
for(i = 0; i < 2; i++){
document.all.mytabla.rows[document.all.mytabla.rows.length-1].insertCell(i);
}
//Llenas con los datos del ultimo registro
for(i = 0; i < 2; i++){
document.all.mytabla.rows[document.all.mytabla.rows.length-1].cells[i].innerText = arrCols[i];
}
}
function agregaRenglon(tmp){
var newVal = showModalDialog("modal.html", "_blank", 'dialogWidth:480px;dialogHeight:640px;dialogTop:75 px;dialogLeft:125px;status=no');
if (!newVal) { return; }
tmp.value += "|" + newVal;
redibujaTabla(tmp.value);
}
</script>
</head>
<body>
<table id="mytabla" border="1">
<thead><tr><td>Campo 1</td><td>Campo 2</td></tr></thead>
<tbody>
</tbody>
</table>
</body>
<textarea name="txtdatos" style="display:none"></textarea>
<input type="button" onclick="agregaRenglon(txtdatos);" value="Agregar valor">
</html>

Tu página Modal
(modal.html)
<html>
<body>
<p>Valor 1: <input type="text" name="valor1"></p>
<p>Valor 2: <input type="text" name="valor2"></p>
<p>
<a href="#" onclick="javascript: parent.window.returnValue=document.all['valor1'].value + ';' + document.all['valor2'].value; window.close(); ">Agregar datos</a>
<a href="#" onclick="javascript: parent.window.returnValue=false; window.close(); ">Cancelar</a>
</p>
</body>
</html>


SALUDOS....
__________________
Yo tan sólo se, que no he senado