IE Win doesn't want my code to create a table

Discussion in 'Javascript' started by ASM, Dec 9, 2006.

  1. ASM

    ASM Guest

    Hi,

    Code bellow works fine with FF2 or my IE Mac
    but not with IE Windows, why ?

    <HTML>
    <SCRIPT type="text/javascript">
    function tableau() {
    var tabl = document.createElement('TABLE');
    alert('starting');
    tabl.id = 'myTable';
    tabl.border = 1;
    tabl.width = '80%';
    for(var r=1; r<5; r++) {
    var rang = document.createElement('TR');
    for(var i=1; i<6; i++) {
    var cel = document.createElement('TD');
    cel.style.textAlign='center';
    cel.innerHTML = 'rang:'+r+' col:'+i;
    //alert (cel.innerHTML );
    rang.appendChild(cel);
    }
    tabl.appendChild(rang);
    }
    document.body.appendChild(tabl);
    }
    </SCRIPT>
    <p><input type="button" value="TEST" name="montage"
    onClick="tableau()"></p>
    </html>

    Medicine ? (compatible all browsers)

    --
    Stephane Moriaux et son (moins) vieux Mac déjà dépassé
    Stephane Moriaux and his (less) old Mac already out of date
     
    ASM, Dec 9, 2006
    #1
    1. Advertising

  2. ASM wrote:

    > Code bellow works fine with FF2 or my IE Mac
    > but not with IE Windows, why ?


    You need to create a tbody element, append that to the table element,
    and append the tr elements to the tbody element.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Dec 9, 2006
    #2
    1. Advertising

  3. ASM

    ASM Guest

    Martin Honnen a écrit :
    >
    > You need to create a tbody element, append that to the table element,
    > and append the tr elements to the tbody element.


    Great ! that works now.


    --
    Stephane Moriaux et son (moins) vieux Mac déjà dépassé
    Stephane Moriaux and his (less) old Mac already out of date
     
    ASM, Dec 9, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ARaman
    Replies:
    1
    Views:
    407
    Mike Wahler
    Oct 23, 2003
  2. Chris Lyon
    Replies:
    0
    Views:
    355
    Chris Lyon
    Oct 7, 2003
  3. Ringwraith
    Replies:
    4
    Views:
    968
    Ringwraith
    Jan 27, 2004
  4. Krist
    Replies:
    6
    Views:
    801
    Arne Vajhøj
    May 7, 2010
  5. pavi
    Replies:
    0
    Views:
    1,390
Loading...

Share This Page