Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/11/2015, 08:06
carlosdlima4
 
Fecha de Ingreso: noviembre-2015
Ubicación: Caracas
Mensajes: 5
Antigüedad: 10 años, 11 meses
Puntos: 0
Pregunta como agregarle texto al las celdas

Hola estoy de vuelta espero no molestar mucho, es que cuando se es nuevo en algo siempre hay algo que se complica, ya logre agregar las fila de la tabla con javascript pero ahora me gustaría añadirle su definición antes de cada input pero no he logrado hacerlo aqui esta el código si no es mucha molestia me explicarían como hacerlo gracias...

Código PHP:
<!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>
    <
meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <
link href="../css/estilos.css" type="text/css" rel="stylesheet"/>
    <
title></title>
    <
script>

        function 
añadir() {

            var 
table = document.getElementById("tabla");
            var 
row = table.insertRow(0);
            
            var 
cell1 = row.insertCell(0);
            var 
cell2 = row.insertCell(1);
            var 
cell3 = row.insertCell(2);
            var 
cell4 = row.insertCell(3);
            var 
cell5 = row.insertCell(4);
            
            
            
            var 
input = document.createElement("input");
            
input.type = "text";
            
input.className = "urlresp";
            
input.value = "";            

           
            var 
input2 = document.createElement("input");
            
input2.type = "text";
            
input2.className = "ptss";
            
input2.value = "";            
            
            
            var 
input3 = document.createElement("input");
            
input3.type = "text";
            
input3.className = "ptss";
            
input3.value = "";            
            
            
            var 
input4 = document.createElement("select");
            
input4.type = "select";
            
input4.className = "ptss";
            
input4.value = "";
            
            
            var 
input5 = document.createElement("input");
            
input5.type = "text";
            
input5.className = "ptss";
            
input5.value = "";

            
            
cell1.appendChild(input);
            
cell2.appendChild(input2);
            
cell3.appendChild(input3);
            
cell4.appendChild(input4);
            
cell5.appendChild(input5);
        }



        function 
eliminar() {
            
document.getElementById("tabla").deleteRow(0);
        }
    
</script>
</head>

<body>
    <table id="tabla" border="0">
        <tr>

        </tr>
    </table>

    <button onclick="añadir()" type="button"><img src="http://www.forosdelweb.com/f13/img/admin/add.png"</button>
    <button onclick="eliminar()" type="button"><img src="http://www.forosdelweb.com/f13/img/admin/cancel.png"</button>
</body>

</html>