Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > IE Win doesn't want my code to create a table

Reply
Thread Tools

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

 
 
ASM
Guest
Posts: n/a
 
      12-09-2006
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
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      12-09-2006
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/
 
Reply With Quote
 
 
 
 
ASM
Guest
Posts: n/a
 
      12-09-2006
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Applet to run on Win 98, Win ME, Win XP, Win Vista & Win 7 ?? Krist Java 6 05-06-2010 11:53 PM
I want to create a link "e-mail this page to a friend" on clicking this link i want to send the URL of that current page to a friend pavi Javascript 0 01-13-2006 12:10 PM
I need to create the table and I want to edit its content from www level. Rootshell Python 1 12-06-2004 02:15 PM
I need to create the table and I want to edit its content from www level. Rootshell Python 2 12-06-2004 02:15 PM
[Newbie to Hibernate] Don't want to create table John Curley Java 1 08-18-2004 01:54 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57