Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > problem: create element in create element

Reply
Thread Tools

problem: create element in create element

 
 
Iulian Ilea
Guest
Posts: n/a
 
      12-14-2006
Hello,

I have a problem and I don't understand why this is happening.
Code:
calendar = document.createElement("div");
calendar.setAttribute("id", "calendar");
table = calendar.createElement("table");
After I create table element nothing apears on the screen.

Thanks in advance!

 
Reply With Quote
 
 
 
 
Iulian Ilea
Guest
Posts: n/a
 
      12-14-2006

Iulian Ilea wrote:
> Hello,
>
> I have a problem and I don't understand why this is happening.
> Code:
> calendar = document.createElement("div");
> calendar.setAttribute("id", "calendar");
> table = calendar.createElement("table");
> After I create table element nothing apears on the screen.
>
> Thanks in advance!


Oh... I found

calendar = document.createElement("div");
calendar.setAttribute("id", "calendar");

table = document.createElement("table");
calendar.appendChild(table);

 
Reply With Quote
 
 
 
 
ASM
Guest
Posts: n/a
 
      12-14-2006
Iulian Ilea a écrit :
> Hello,
>
> I have a problem and I don't understand why this is happening.
> Code:
> calendar = document.createElement("div");
> calendar.setAttribute("id", "calendar");
> table = calendar.createElement("table");
> After I create table element nothing apears on the screen.
>
> Thanks in advance!
>


With IE you have to create a tbody before to create tr and tds

of course you appendChild each new element in right place
still to the document.body


--
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
 
ASM
Guest
Posts: n/a
 
      12-14-2006
Iulian Ilea a écrit :
> Oh... I found
>
> calendar = document.createElement("div");
> calendar.setAttribute("id", "calendar");
>
> table = document.createElement("table");
> calendar.appendChild(table);
>


what is that ?

--
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
 
Iulian Ilea
Guest
Posts: n/a
 
      12-17-2006

ASM wrote:
> Iulian Ilea a écrit :
> > Oh... I found
> >
> > calendar = document.createElement("div");
> > calendar.setAttribute("id", "calendar");
> >
> > table = document.createElement("table");
> > calendar.appendChild(table);
> >

>
> what is that ?
>
> --
> Stephane Moriaux et son (moins) vieux Mac déjà dépassé
> Stephane Moriaux and his (less) old Mac already out of date


That is the correct way to append an element to a document (from what I
read). If you look in the first post I appended table to calendar.

 
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
how to Update/insert an xml element's text----> (<element>text</element>) HANM XML 2 01-29-2008 03:31 PM
The element 'compilation' has invalid child element 'compilers'. =?Utf-8?B?Um9iZXJ0?= ASP .Net 3 11-15-2005 01:48 AM
java.lang.NoSuchMethodError: org.jdom.Element: method getParent()Lorg/jdom/Element Tinker Java 4 10-09-2005 03:12 PM
moving from form element to form element Rod Snyder ASP .Net 1 05-29-2004 01:55 PM
per the active schema, the element <BR> must be included within a parent element MSNews ASP .Net 1 04-22-2004 04:45 PM



Advertisments