Foros del Web » Programando para Internet » Javascript »

innerHTML y documentos dinamicos PHP

Estas en el tema de innerHTML y documentos dinamicos PHP en el foro de Javascript en Foros del Web. Hola bueno mi pregunta es bastante sencilla aunque tengo la idea clara necesito una senal. Tengo el siguiente codigo. Código PHP:        function  addEvent () { ...
  #1 (permalink)  
Antiguo 09/03/2011, 15:05
Avatar de eddwinpaz  
Fecha de Ingreso: noviembre-2007
Ubicación: Merida , Venezuela
Mensajes: 1.066
Antigüedad: 16 años, 5 meses
Puntos: 25
Mensaje innerHTML y documentos dinamicos PHP

Hola bueno mi pregunta es bastante sencilla aunque tengo la idea clara necesito una senal.

Tengo el siguiente codigo.

Código PHP:
      function addEvent() {
                var 
ni document.getElementById('foc_datasheet_form');
                var 
numi document.getElementById('theValue');
                var 
num = (document.getElementById("theValue").value -1)+ 2;
                
numi.value num;
                var 
divIdName "my"+num+"Div";
                var 
newdiv document.createElement('div');
                
newdiv.setAttribute("id",divIdName);
                
// newdiv.innerHTML = "Element Number " + num + " has been added! <a href=\"javascript:;\" onclick=\"removeElement(\'"+divIdName+"\')\">Remove the element &quot;"+divIdName+"&quot;</a>";
  
                
newdiv.innerHTML '<div class="asfe-LayoutBox gbox-primary-overview syn-home-overview-performance"  id="gwt-debug-overviewPageWidget-performanceSummaryWidget">'+
                    
'<div class="gbox-top gwt-HTML"><strong class="gbox-b1"> </strong>'+
                    
'<strong class="gbox-b2"> </strong><strong class="gbox-b3"> </strong></div>'+
                    
'<div class="gbox-border">'+
                    
'<div class="gbox-header gbox-primary-overview-title gbox-title"><span class="gwt-InlineLabel">Form Number 'num+' - Fiber Optic Cable (FOC)</span>' +
                    
                    
'</div>'+
                    
'<div class="gbox-body">  <table cellspacing="0" cellpadding="0" class="asfe-DynamicTable syn-home-overview-performance-table">'+
                    
'<tbody> <tr>    <td align="left" class="c1"> <table cellspacing="0" cellpadding="0" class="nav-bar c11">'+
                    
'<tbody> <tr> <td align="left" class="c1"> <table cellspacing="0" cellpadding="0" align="left">'+
                    
'<tbody> <tr>  <td></td> </tr> </tbody> </table>  </td> <td align="left" class="c1">'+
                    
'<table cellspacing="0" cellpadding="0" align="center" class="c9">'+
                    
'<tbody> <tr> <td></td>  </tr> </tbody>  </table> </td>'+
                    
'<td align="left" class="c1"> <table cellspacing="0" cellpadding="0" align="right">'+
                    
'<tbody>  <tr> <td></td> </tr> </tbody> </table>  </td> </tr>'+
                  
                    
'<col class="syn-report-column-metric"></colgroup> <tbody>'+
                    
'<tr class="header-row">'+
                    
'<td width="19%" align="left" class="syn-report-cell-category column-unsorted asfe-DynamicTableHeaderCell">Classification</td>'+
                    
'<td width="32%" align="left" class="syn-report-cell-metric column-unsorted asfe-DynamicTableHeaderCell">Characteristics</td>'+
                    
'<td width="22%" align="left" class="syn-report-cell-metric column-unsorted asfe-DynamicTableHeaderCell">'+
                    
'<span class="syn-report-cell-category column-unsorted asfe-DynamicTableHeaderCell">Classification</span></td>'+
                    
'<td width="27%" align="left" class="syn-report-cell-metric column-unsorted asfe-DynamicTableHeaderCell">Characteristics</td>'+
                    
'</tr> <tr> <td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-000-001">Total Number of Fiber</td>'+
                    
'<td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-001-001">'+
                    
'<input type="text" name="project_name" id="project_name" style="padding:5px; width:240px;"></td>'+
                    
'<td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-002-001">Number of Loose Tubes</td>'+
                    
'<td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-003-001"><input type="text" name="textfield" id="textfield" style="padding:5px; width:240px;"></td>'+
                    
'</tr><tr> <td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-000-002">Number of filler</td>'+
                    
'<td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-001-001">'+
                    
'<input type="text" name="textfield2" id="textfield2" style="padding:5px; width:240px;"></td>'+
                    
'<td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-002-001">Overall Diameter (mm)</td>'+
                    
'<td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-003-001"><input type="text" name="textfield6" id="textfield6" style="padding:5px; width:240px;"></td>'+
                    
'</tr> <tr> <td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-000-003">Tube Material</td>'+
                    
'<td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-001-001">'+
                    
'<select name="select4" id="select4" style="padding:5px; width:250px;">'+
                    
'<option>Please Select Tube Material</option>'+
                    
'<option>PBT</option>'+
                    
'<option>Other</option>'+
                    
'<option>N/A</option>'+
                    
'</select></td>'+
                    
'<td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-002-001">Filler Material</td>'+
                    
'<td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-003-001">'+
                    
'<select name="select5" id="select5" style="padding:5px; width:250px;">'+
                    
'<option>Please Select Filler Material</option>'+
                    
'<option>PBT</option>'+
                    
'<option>Other</option>'+
                    
'</select></td>'+
                    
'</tr>'+
                    
'<tr>'+
                    
'<td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-000-004">Central Strengh Member</td>'+
                    
'<td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-001-001">'+
                    
'<select name="select6" id="select6" style="padding:5px; width:250px;">'+
                    
'<option>Please Select Central Streng Member</option>'+
                    
'<option>FRP</option>'+
                    
'<option>Metallic</option>'+
                    
'<option>Other</option>'+
                    
'</select></td>'+
                    
'<td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-002-001">Water Blocking Material</td>'+
                    
'<td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-003-001">'+
                    
'<input type="checkbox" name="checkbox2" id="checkbox2"> Jelly C'+
                    
'<input type="checkbox" name="checkbox3" id="checkbox3"> WBT'+
                    
'<input type="checkbox" name="checkbox4" id="checkbox4"> WBY    '+
                    
'<input type="checkbox" name="checkbox" id="checkbox"> NHPT</td>'+
                    
'</tr><tr> <td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-000-004">Wrapping Material</td>'+
                    
'<td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-001-001">'+
                    
'<select name="select7" id="select7" style="padding:5px; width:250px;">'+
                    
'<option>Please Select Wrapping Material</option>'+
                    
'<option>Wrapping Tape</option>'+
                    
'<option>Other</option>'+
                    
'</select></td>'+
                    
'<td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-002-001">Inner Shealth Material</td>'+
                    
'<td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-003-001">'+
                    
'<select name="select8" id="select8" style="padding:5px; width:250px;">'+
                    
'<option>Please Select Inner Shealth Material</option>'+
                    
'<option>PEHD</option>'+
                    
'<option>PEBD</option>'+
                    
'<option>Anti Tracking</option>'+
                    
'<option>Flame Retardant</option>'+
                    
'</select></td>'+
                    
'</tr>'+
                    
'<tr>'+
                    
'<td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-000-004">Tensile Elements</td>'+
                    
'<td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-001-001">'+
                    
'<select name="select9" id="select9" style="padding:5px; width:250px;">'+
                    
'<option>Please Select Tensile Elements</option>'+
                    
'<option>Messenger Wire</option>'+
                    
'<option>Aramid Yarn</option>'+
                    
'<option>Glassyarn</option>'+
                    
'</select></td>'+
                    
'<td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-002-001">Outter Shealth Material</td>'+
                    
'<td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-003-001">'+
                    
'<select name="select10" id="select10" style="padding:5px; width:250px;">'+
                    
'<option>Please Select Outter Shealth Material</option>'+
                    
'<option>Messenger Wire</option>'+
                    
'<option>Aramid Yarn</option>'+
                    
'<option>Glassyarn</option>'+
                    
'</select></td>'+
                    
'</tr>'+
                    
'<tr>'+
                    
'<td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-000-004">Cable Weight <br></td>'+
                    
'<td class="asfe-DynamicTableCell" id="gwt-debug-tablecell-001-001">'+

                    
'<strong class="gbox-b2"> </strong><strong class="gbox-b1"> </strong></div></div>';
              
                
ni.appendChild(newdiv);
            }

            function 
removeElement(divNum) {
                var 
document.getElementById('foc_datasheet_form');
                var 
olddiv document.getElementById(divNum);
  
                
d.removeChild(olddiv);
            } 
de esta manera puedo agregar cuantas forms yo quiera. usando el addEvent() handler. yo quisiera es que el innerHTML = foc_gen.php y agregar cuantos documentos sean necesario haciendo click y poder eliminarlos al mismo tiempo..

ya que todos los select son dinamicos y estan generados via PHP.

Gracias por su ayuda de antemano.
__________________
O nos hacemos miserables o nos hacemos fuertes , la cantidad de trabajo es la misma.
  #2 (permalink)  
Antiguo 09/03/2011, 15:09
Avatar de eddwinpaz  
Fecha de Ingreso: noviembre-2007
Ubicación: Merida , Venezuela
Mensajes: 1.066
Antigüedad: 16 años, 5 meses
Puntos: 25
Respuesta: innerHTML y documentos dinamicos PHP

Lo que quiero es poder hacer lo mismo pero en vez de tener todo es HTML en el mismo documento HTML quiero es llamarlo de manera externa y que me lo integre en el formulario actual. y asi mismo poder eliminarlo del formulario usando la funcion removeElement(divNum)
__________________
O nos hacemos miserables o nos hacemos fuertes , la cantidad de trabajo es la misma.

Etiquetas: dinamicos, documentos, innerhtml, php
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 14:15.