Ver Mensaje Individual
  #9 (permalink)  
Antiguo 06/11/2011, 18:06
augusto_jaramil
 
Fecha de Ingreso: junio-2004
Ubicación: Ciudad de Panama
Mensajes: 551
Antigüedad: 20 años, 8 meses
Puntos: 8
Respuesta: Este Script se ejecuta 1 sola vez ajax.responseText.. Why?

PARTE II

Código PHP:
String.prototype.trim = function() { return this.replace(/^s+|s+$/g""); };

function 
crearFilas() {

   var 
reporte document.getElementById("reporte");
   
reporte.innerHTML "";

   var 
grups document.getElementById("grupos").value;
   
str grups.trim();
   var 
grups parseInt(str);

   var 
cols document.getElementById("cols").value;
   
str cols.trim();
   var 
cols parseInt(str);

   if (
cols 1)
      
largo = ((152*cols+1)+(4*cols));
   else
      
largo 152*cols+1;

   
tbl document.createElement("table");
     
tbl.setAttribute("cellspacing""0");
     
tbl.setAttribute("cellpadding""0");
     
tbl.setAttribute("border""1");
     
tbl.setAttribute("background-color""white");

   
0;
   
1;

//TITULOS
   
totlar = ((largo*grups)+(1*cols))+152;
   
colsxlin = (cols*grups)+1;
   for (
i=0;i<2;i++) {
       
tr document.createElement("tr");
       
idtit="tit"+i;
       
nuevoTDt document.createElement("td");
            
nuevoTDt.setAttribute("colspan"colsxlin);
            
nuevoTDt.setAttribute("align""center");

       
input document.createElement("input");
            
input.setAttribute("type""text");
            
input.setAttribute("id"idtit);
            
input.setAttribute("name"idtit);
            if (
i==0)
               
input.setAttribute("value""Titulo Reporte");
            else
               
input.setAttribute("value""Subtitulo Reporte");
            
input.setAttribute("class""claseinput");
            
estilo "text-align:center; color:blue; width:"+totlar+"px";
            
input.setAttribute("style"estilo);
       
nuevoTDt.appendChild(input);
       
tr.appendChild(nuevoTDt);
       
tbl.appendChild(tr);
   }


   
tr document.createElement("tr");

//GRUPOS
   
nuevoTDz document.createElement("td");
       
nuevoTDz.setAttribute("class""clasetd");
   
tr.appendChild(nuevoTDz);

   for (
i=0;i<grups;i++) {
       
idnameg="grp"+k+"_0";
       
nuevoTDg document.createElement("td");
            
nuevoTDg.setAttribute("colspan"cols);
            
nuevoTDg.setAttribute("align""center");

       
input document.createElement("input");
            
input.setAttribute("type""text");
            
input.setAttribute("id"idnameg);
            
input.setAttribute("name"idnameg);
            
input.setAttribute("value""Titulo Grupo "+k);
            
input.setAttribute("class""claseinput");
            
estilo "text-align:center; color:blue; width:"+largo+"px";
            
input.setAttribute("style"estilo);
            
input.setAttribute("onChange""verificaInput('"+idnameg+"');");
       
nuevoTDg.appendChild(input);
       
tr.appendChild(nuevoTDg);
       
tbl.appendChild(tr);
       
k++;
   }

//COLUMNAS
   
tr document.createElement("tr");
   
idtit="c0_0";
   
nuevoTDx document.createElement("td");
        
nuevoTDx.setAttribute("colspan""1");
        
nuevoTDx.setAttribute("align""center");

   
input document.createElement("input");
        
input.setAttribute("type""text");
        
input.setAttribute("id"idtit);
        
input.setAttribute("name"idtit);
        
input.setAttribute("value""Id");
        
estilo "text-align:center; color:red; width:152px";
        
input.setAttribute("style"estilo);
        
input.setAttribute("class""claseinput");
        
input.setAttribute("onChange""verificaInput('"+idtit+"');");
   
nuevoTDx.appendChild(input);
   
tr.appendChild(nuevoTDx);

   
1;
   
1;
   
col_orig cols;
   
cols grups*cols;
   for (
j=0;j<cols;j++) {
       
idnamec "c"+k+"_"+g;
       
nuevoTDt document.createElement("td");
            
nuevoTDt.setAttribute("colspan""1");

       
input document.createElement("input");
            
input.setAttribute("type""text");
            
input.setAttribute("id"idnamec);
            
input.setAttribute("name"idnamec);
            
input.setAttribute("value""Titulo Columna "+k);
            
input.setAttribute("class""claseinput");
            
estilo "text-align:center; color:red; width:152px;";
            
input.setAttribute("style"estilo);
            
input.setAttribute("onChange""verificaInput('"+idnamec+"');");
       
nuevoTDt.appendChild(input);
       
tr.appendChild(nuevoTDt);
       
k+1;
       if (
k>col_orig) {
          
g+1;
          
k=1;
       }
   }
   
tbl.appendChild(tr);

//SELECTS
   
tr document.createElement("tr");
   
1;
   
1;
   for (
j=0;j<cols;j++) {
       
idnames "s"+k+"_"+g;
       if (
== 0) {
          
nuevoTDs document.createElement("td");
               
nuevoTDs.setAttribute("colspan""1");

          
nuevoSelect document.createElement("select");
               
nuevoSelect.setAttribute("id""s0_0");
               
nuevoSelect.setAttribute("name""s0_0");
               
//nuevoSelect.setAttribute("style", "width:152px; background-color:#B0E0E6;");
               
nuevoSelect.setAttribute("style""width:152px; background-color:transparent; font-size=12px; border:solid #B0E0E6;");
               
nuevoSelect.setAttribute("onChange""muestra_textArea(0,0);");

          
opt document.createElement("Option");
            
opt.setAttribute("value""I");
            
opt.innerHTML="Seleccione Filtro";
            
opt.setAttribute("selected","0");
            
opt.setAttribute("style""background-color:#00FFFF;");
          
nuevoSelect.appendChild(opt);

          
opt document.createElement("Option");
            
opt.setAttribute("style""background-color:#00FFFF;");
            
opt.setAttribute("value""Q");
            
opt.innerHTML="Query";
          
nuevoSelect.appendChild(opt);

          
nuevoTDs.appendChild(nuevoSelect);
          
tr.appendChild(nuevoTDs);
       }

       
nuevoTDs document.createElement("td");
            
nuevoTDs.setAttribute("colspan""1");

       
nuevoSelect document.createElement("select");
            
nuevoSelect.setAttribute("id"idnames);
            
nuevoSelect.setAttribute("name"idnames);
            
//nuevoSelect.setAttribute("style", "width:152px; background-color:#B0E0E6;");
               
nuevoSelect.setAttribute("style""width:152px; background-color:transparent; font-size=12px; border:solid #B0E0E6;");
            
nuevoSelect.setAttribute("onChange""muestra_textArea("+k+", "+g+");");

       
opt document.createElement("Option");
         
opt.setAttribute("value""0");
         
opt.innerHTML="Seleccione Filtro";
         
opt.setAttribute("selected","0");
         
opt.setAttribute("style""background-color:#00FFFF;");
       
nuevoSelect.appendChild(opt);

       
opt document.createElement("Option");
         
opt.setAttribute("style""background-color:#00FFFF;");
         
opt.setAttribute("value""Q");
         
opt.innerHTML="Query";
       
nuevoSelect.appendChild(opt);

       
opt document.createElement("Option");
         
opt.setAttribute("style""background-color:#00FFFF;");
         
opt.setAttribute("value""F");
         
opt.innerHTML="Formula";
       
nuevoSelect.appendChild(opt);

       
opt document.createElement("Option");
         
opt.setAttribute("style""background-color:#00FFFF;");
         
opt.setAttribute("value""C");
         
opt.innerHTML="Copiar Desde Columna";
       
nuevoSelect.appendChild(opt);

       
nuevoTDs.appendChild(nuevoSelect);
       
tr.appendChild(nuevoTDs);

       
k=k+1;
       if (
k>col_orig) {
          
g+1;
          
k=1;
       }
   }
   
tbl.appendChild(tr);

//TEXTAREA
   
tr document.createElement("tr");

   
1;
   
1;
   
cols cols+1;
   for (
j=0;j<cols;j++) {
       if (
j==0) {
          
idnamet "t0_0";
          
0;
       }
       else
          
idnamet "t"+k+"_"+g;
       
nuevoTDa document.createElement("td");
            
nuevoTDa.setAttribute("colspan""1");

       
textarea document.createElement("textarea");
            
textarea.setAttribute("id"idnamet);
            
textarea.setAttribute("name"idnamet);
            
textarea.setAttribute("rows""30");
            
textarea.setAttribute("cols""87");
            
textarea.setAttribute("onChange""verificaInput('"+idnamet+"');");
            
fun "oculta_textArea('"+idnamet+"');";
            
textarea.setAttribute("style""display : none");
            
textarea.setAttribute("onBlur"fun);
       
nuevoTDa.appendChild(textarea);
       
tr.appendChild(nuevoTDa);
       
k+1;
       if (
k>col_orig) {
          
g+1;
          
k=1;
       }
   }
   
tbl.appendChild(tr);

// BOTONES
   
tr document.createElement("tr");
   
nuevoTDb document.createElement("td");
        
nuevoTDb.setAttribute("align""center");
        
nuevoTDb.setAttribute("colspan"largo);

   
nuevoBoton document.createElement("input");
      
nuevoBoton.setAttribute("type""button");
      
nuevoBoton.setAttribute("id""graba");
      
nuevoBoton.setAttribute("accion""graba");
      
nuevoBoton.setAttribute("value""Grabar");
      
nuevoBoton.setAttribute("onClick""fDatos('reporte','grabar');");
      
nuevoBoton.setAttribute("style""background-color:#738EB5; height:18px; font-size:8pt; font-weight:bold; color:#FFFFFF; border-style:solid; border-width:1px;");
   
nuevoTDb.appendChild(nuevoBoton);
   
tr.appendChild(nuevoTDb);
   
tbl.appendChild(tr);

   
reporte.appendChild(tbl);

/*
var ss = document.getElementById('reporte').innerHTML;
ss = ss.replace(/>/g, "&gt;");
ss = ss.replace(/</g, "&lt;");
document.write(ss);
*/
   
ds document.getElementById("reporte");
   
ds.style.display "block";
   
reporte.style.display "block";
}

function 
verificaInput(par) {
//alert(document.getElementById(par).offsetWidth);
   //alert(document.getElementById(par).value);