How to make this JavaScript work in Internet Explorer 6 & 7 ?

Posted by karlthorwald on Stack Overflow See other posts from Stack Overflow or by karlthorwald
Published on 2010-04-08T21:20:24Z Indexed on 2010/04/08 21:23 UTC
Read the original article Hit count: 202

After many hours of debugging I am tired, maybe you can help me now to solve this:

In a new Firefox it works, in my Internet Explorer 6 or 7 it doesn't:

<html>
<head>

    <script type="text/javascript">
      function newLine() {
        var tdmod = document.createElement('td');
        tdmod.appendChild(document.createTextNode("dynamic"));

        var tr = document.createElement('tr');
        tr.appendChild(tdmod);

        var tt  = document.getElementById("t1");
        tt.appendChild(tr);
      }     

    </script>


</head>
<body>

    <a href="#" onclick="newLine()">newLine</a>

      <table id="t1" border="1">
        <tr>
          <td>
          static
          </td>  
        </tr>
      </table>


</body>

You can klick on the link and new lines should be added to the table.

Try it here: http://dl.dropbox.com/u/1508092/iejs.html#

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about internet-explorer