Ver Mensaje Individual
  #2 (permalink)  
Antiguo 14/11/2011, 09:44
augusto_jaramil
 
Fecha de Ingreso: junio-2004
Ubicación: Ciudad de Panama
Mensajes: 551
Antigüedad: 19 años, 10 meses
Puntos: 8
Respuesta: Tablas Dinamicas en JavaScript

Ta lvez esto te pueda ayudar,

Código PHP:
function creaTd(columnas,ident,tablaActual) {

  var 
repor document.getElementById(tablaActual);
  
repor.innerHTML "";

  
idtbl "columnas_"+ident;
  
tbl document.createElement("table");
    
tbl.setAttribute("style""border-width:1px;border-style:solid outset;border-color:#FFFFFF;border-collapse:separate;background-color:#87CAFA");
    
tbl.setAttribute("id"idtbl);
    
tbl.setAttribute("width""100%");

  
tbd document.createElement("tbody");

  
tr document.createElement("tr");
  
colum document.getElementById(columnas).value;
  for(
i=1;i<=columnas;i++) {
     
TDt document.createElement("td");
        
TDt.setAttribute("class""clasetd");
        
TDt.setAttribute("align""center");

     
idCol=ident+i;
     
input document.createElement("input");
        
input.setAttribute("type""text");
        
input.setAttribute("id"idCol);
        
input.setAttribute("name"idCol);
        
input.setAttribute("value""Defina Titulo "+Texto+" "+i);
        
input.setAttribute("class""claseinput");
        
estilo "text-align:center; color:blue; width:190px";
        
input.setAttribute("style"estilo);
     if (
i==columnas) {
        
input.setAttribute("onChange""mostrarBotones('','"+tablaSiguiente+"');");
     }
     
TDt.appendChild(input);
     
tr.appendChild(TDt);
  }
  
tbl.appendChild(tr);

  
tr document.createElement("tr");
  
nuevoTDb document.createElement("td");
       
nuevoTDb.setAttribute("align""right");
       
nuevoTDb.setAttribute("style""font-size:10px;font-weight:bold");
       
nuevoTDb.setAttribute("colspan"columnas);

  
nuevoBoton document.createElement("input");
     
nuevoBoton.setAttribute("type""image");
     
nuevoBoton.setAttribute("id""grabagr");
     
nuevoBoton.setAttribute("accion""grabagr");
     
nuevoBoton.setAttribute("value""Grabar");
     
nuevoBoton.setAttribute("onClick""mostrarBotones('','"+tablaSiguiente+"');");
     
nuevoBoton.setAttribute("width""30");
     
nuevoBoton.setAttribute("height""40");
     
nuevoBoton.setAttribute("src""./imagenes/zip_disk_flap_open_md_wht.gif");
  
nuevoTDb.appendChild(nuevoBoton);
  
tr.appendChild(nuevoTDb);

  
tbl.appendChild(tbd);
  
tbl.appendChild(tr);
  
repor.appendChild(tbl);

  
repor.style.display "block";