Foros del Web » Programando para Internet » Javascript »

Ayuda formulario

Estas en el tema de Ayuda formulario en el foro de Javascript en Foros del Web. Foreros, Pido ayuda de nuevo, pero les muestro un poco de codigo a ver si se entiende un poco mejor. Código: <!DOCTYPE html PUBLIC "-//W3C//DTD ...
  #1 (permalink)  
Antiguo 05/02/2011, 17:45
 
Fecha de Ingreso: mayo-2006
Mensajes: 124
Antigüedad: 18 años
Puntos: 0
Ayuda formulario

Foreros, Pido ayuda de nuevo, pero les muestro un poco de codigo a ver si se entiende un poco mejor.

Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>


<script type="text/javascript">
var indiceFila_2 = 0;
function NuevaFila_2() {
myNewRow = document.getElementById("Tabla_2").insertRow(-1);


               myNewCell=myNewRow.insertCell(-1);
               var elemento = document.createElement("INPUT");
               elemento.setAttribute("type","select");
               elemento.setAttribute("type","text");
               elemento.setAttribute("size","55");
               elemento.setAttribute("maxlength","255");
               elemento.setAttribute("name","hijo_numero[]");
               elemento.setAttribute("id","curso_1_nombre_" + indiceFila_2);
               myNewCell.appendChild(elemento);
               
               myNewCell=myNewRow.insertCell(-1);
               var elemento2 = document.createElement("INPUT");
               elemento2.setAttribute("type","text");
               elemento2.setAttribute("size","55");
               elemento2.setAttribute("maxlength","255");
               elemento2.setAttribute("name","curso_1_lugar[]");
               elemento2.setAttribute("id","curso_1_lugar_" + indiceFila_2);
               myNewCell.appendChild(elemento2);
               
               
                
			   
			    
indiceFila_2++;
}


function quitaFilaATabla_2() {
var tbl = document.getElementById('Tabla_2');
var lastRow = tbl.rows.length;
if (lastRow > 3) tbl.deleteRow(lastRow - 1);
}
</script>



<title>* OSPAT * Carga de datos</title>
<style type="text/css">
<!--
.style1 {
	font-size: 12px;
	font-weight: bold;
}
-->
</style>
</head>
<body >

      
      

     


            <table id="Tabla_2">
        <tr>
          <td colspan="3"><div align="center"><strong>Cursos de especializaci&oacute;n</strong></div></td>
        </tr>
        <tr>
          <td>Nombre </td>
          <td>Lugar</td>
           </tr>
            <tr> 
            <td><input name="curso_1_nombre[]" type="text" id="curso_1_nombre_0" size="55" maxlength="255" /></td>
          <td><input name="curso_1_lugar[]" type="text" id="curso_1_lugar_0" size="55" maxlength="255" /></td>
          </tr>
          <a href="#"  onClick="NuevaFila_2()">Agregar curso</a> || <a href="#"   onClick="quitaFilaATabla_2()">Eliminar curso</a>
      </table>
	  <p>&nbsp;</p>
 

  </div>
  
  <div align="center">
    <input name="send" type="submit" value="Enviar">
</div>
</form>
</body>
</html>

Lo que necesito es que en vez de una caja de texto ma aparezca un list / select / menu ......

como hago?
  #2 (permalink)  
Antiguo 05/02/2011, 18:58
 
Fecha de Ingreso: diciembre-2010
Mensajes: 788
Antigüedad: 13 años, 4 meses
Puntos: 51
Respuesta: Ayuda formulario

Deberías empezar por:

cambiar

Código Javascript:
Ver original
  1. var elemento = document.createElement("INPUT");

por

Código Javascript:
Ver original
  1. var elemento = document.createElement("SELECT");
  #3 (permalink)  
Antiguo 06/02/2011, 21:57
Avatar de ARICARRARO  
Fecha de Ingreso: diciembre-2010
Ubicación: México
Mensajes: 227
Antigüedad: 13 años, 4 meses
Puntos: 10
Respuesta: Ayuda formulario

Buena info

Etiquetas: formulario
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 02:40.