Ver Mensaje Individual
  #3 (permalink)  
Antiguo 15/05/2009, 00:09
Avatar de alor86
alor86
 
Fecha de Ingreso: abril-2009
Mensajes: 110
Antigüedad: 15 años, 1 mes
Puntos: 5
Respuesta: Problema con javascript

Cita:
Iniciado por buzu Ver Mensaje
innerHTML no funciona con tablas.

Puedes probar con:

Código javascript:
Ver original
  1. div2 = document.getElementById('idDiv2');
  2. document.getElementById('idDiv1').appendChild(div2);

Espero que te resuelva el problema
no sabia que el innerHTML no funcionara on tablas
asi que me puese a comprobarlo y resulto que si me funciono contablas tanto en FF como en IE probe este codigo y si me genero la tabla.

Código:
<html>

<head>
    <title>x</title>
    <script type="text/javaSCript">
        function x(){
        var d1 = document.getElementById('1');
        var d2 = document.getElementById('2');
        alert(d1.innerHTML);    
        d2.innerHTML=d1.innerHTML;
        }
    </script>
</head>

<body>
    <input type="button" value="axx" onclick="x()"/>
<div id="1">
    <table border="1">
        <tr>
            <td>a</td>
            <td>b</td>
            <td>c</td>
            <td>d</td>
        </tr>
        <tr>
            <td>1</td>
            <td>2</td>
            <td>3</td>
            <td>4</td>
        </tr>
        <tr>
            <td>1</td>
            <td>d</td>
            <td>f</td>
            <td>a</td>
        </tr>
    </table>
</div>
<div id="2">

</div>
</body>
</html>