Retroceder   Foros del Web > Programación para sitios web > Javascript > Frameworks

Respuesta
 
Herramientas Desplegado
Antiguo 25-jun-2008, 08:13   #1 (permalink)
anion0x ha deshabilitado el karma
 
Fecha de Ingreso: junio-2008
Mensajes: 100
consulta dom

Tengo la siguiente tabla:

Código:
        <div class="bottomLine">
			<table id="tabla">
              <tr>
                <th><label for="secundario">Título Secundario</label></th>
                <td><input type="text" name="secundario" id="secundario" value="<?=v('secundario')?>" /></td>
                <th><label for="institucion">Institución</label></th>
                <td><input type="text" name="institucion" id="institucion" value="<?=v('institucion')?>" /></td>
                </tr>
              <tr>
                <th><label for="universitario">Título Universitario</label></th>
                <td><input type="text" name="universitario" id="universitario" value="<?=v('universitario')?>" /></td>
                <th><label for="institucion2">Institución</label></th>
                <td><input type="text" name="institucion2" id="institucion2" value="<?=v('institucion2')?>" /></td>
              </tr>
              <tr>
                <th><label for="idiomas">Idiomas</label></th>
                <td><input type="text" name="idiomas" id="idiomas" value="<?=v('idiomas')?>" /></td>
                <th><label for="domIdioma">% de dominio</label></th>
                <td><input class="short" type="text" name="domIdioma" id="domIdioma" value="<?=v('domIdioma')?>" /> <a href="#" id="agregarId">[+] Agregar</a>
			  </tr>
			  <tr>
                <th><label for="sistemas">Manejo de sistemas</label></th>
                <td><input type="text" name="sistemas" id="sistemas" value="<?=v('sistemas')?>" /></td>
                <th><label for="domIdioma">% de dominio</label></th>
                <td><input class="short" type="text" name="domSistema" id="domSistema" value="<?=v('domSistema')?>" /> <a href="#" >[+] Agregar sistema</a></td>
              </tr>
              <tr>
                <th><label for="estudia">Estudia actualmente</label></th>
                <td><input class="short" name="estudia" type="radio" value="si" /><label for="si">Si</label> <input class="short" name="estudia" type="radio" value="no" /><label for="no">No</label></td>
                <th><label for="carrera">Carrera</label></th>
                <td><input type="text" name="carrera" id="carrera" value="<?=v('carrera')?>" /></td>
              </tr>
			<script type="text/javascript" src="menu.js">
				insertarIdioma();
			</script>
            </table>
        </div>
el siguiente javascript:

Código:
function insertarIdioma()
{
	document.getElementById('agregarId').onclick = function() {

	row = document.createElement('tr');
	head1 = document.createElement('th');
	label1 = document.createElement('label');
	
	head2 = document.createElement('th');
	label2 = document.createElement('label');	
	
	text1 = document.createTextNode("Idiomas");
	data1 = document.createElement('td');
	input1 = document.createElement('input');
	input1.setAttribute("name","idiomas");
	input1.setAttribute("type","text");
	
	text2 = document.createTextNode("% de dominio");
	data2 = document.createElement('td');
	input2 = document.createElement('input');
	input2.setAttribute("name","domIdioma");	
	input2.setAttribute("type","text");
	
	label1.appendChild(text1);
	head1.appendChild(label1);
	row.appendChild(head1);
	row.appendChild(data1);
		
	data1.appendChild(input1);
	
	label2.appendChild(text2);
	head2.appendChild(label2);
	row.appendChild(head2);
		
	data2.appendChild(input2);
		
	row.appendChild(data2);

	document.getElementById('tabla').appendChild(row);
	
	return false;
	}
}
No me funciona, la verdad que no puedo localizar que problema tiene. Me ayudan?
anion0x está desconectado   Responder Citando
Antiguo 28-jun-2008, 10:26   #2 (permalink)
marcopoloaz06 ha deshabilitado el karma
 
Avatar de marcopoloaz06
 
Fecha de Ingreso: julio-2007
Ubicación: Metro Neza,Edo.Méx
Mensajes: 295
Enviar un mensaje por MSN a marcopoloaz06
Respuesta: consulta dom

hola,
solo tienes
que ponerlo
en la funcion onload
Código HTML:
onload = function(){

	document.getElementById('agregarId').onclick = function() {

	row = document.createElement('tr');
	head1 = document.createElement('th');
	label1 = document.createElement('label');
	
	head2 = document.createElement('th');
	label2 = document.createElement('label');	
	
	text1 = document.createTextNode("Idiomas");
	data1 = document.createElement('td');
	input1 = document.createElement('input');
	input1.setAttribute("name","idiomas");
	input1.setAttribute("type","text");
	
	text2 = document.createTextNode("% de dominio");
	data2 = document.createElement('td');
	input2 = document.createElement('input');
	input2.setAttribute("name","domIdioma");	
	input2.setAttribute("type","text");
	
	label1.appendChild(text1);
	head1.appendChild(label1);
	row.appendChild(head1);
	row.appendChild(data1);
		
	data1.appendChild(input1);
	
	label2.appendChild(text2);
	head2.appendChild(label2);
	row.appendChild(head2);
		
	data2.appendChild(input2);
		
	row.appendChild(data2);

	document.getElementById('tabla').appendChild(row);
	
	return false;
	}
}
saludos...
:]
__________________
ya me regañaron :[
http://userscripts.org/scripts/show/20617
Haciendo juego en Javascript 75%
marcopoloaz06 está desconectado   Responder Citando
Respuesta

No hay votos aún.


Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

BB code is Activado
Caritas están Activado
[IMG] está Activado
Código HTML está Desactivado


La Zona horaria es GMT -6. Ahora son las 15:53.


Message Board Statistics

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93