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

A

ASM

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)
 
M

Martin Honnen

ASM said:
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.
 
A

ASM

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top