Ver Mensaje Individual
  #2 (permalink)  
Antiguo 30/10/2012, 10:15
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: boton onclick javascript

Me parece que estás haciendo el camino dificil
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2.    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <title>titulo</title>
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6. <script type="text/javascript">
  7. //<![CDATA[
  8. function addIdiomas(totalCampos) {
  9. var contenido = "<ul id='lista'>\n";
  10. document.getElementById("contenidoIdiomas");
  11. for(i = 1; i <= (totalCampos); i++){
  12. contenido += "<li class='elementolista'><input type='text' id='a_" + i + "' value='' /><\/li>\n";
  13. }
  14. document.getElementById("contenidoIdiomas").innerHTML = contenido + "<\/ul>\n<br \/>\n<input type='button' value='guardar' onclick=\"alert(document.getElementById(\'a_1\').value)\" />\n";
  15. }
  16. //]]>
  17. </head>
  18. <button onclick="addIdiomas(10);">Generar</button>
  19. <div id="contenidoIdiomas"></div>
  20. </body>
  21. </html>

Recordá que tus id, deben de ser únicos y no pueden ser o comenzar por un número
Agregue un evento al botón guardar para que verifiques
SAludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.