Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-03-2009, 05:41 PM   PM User | #1
Sleeping_Troll
New Coder

 
Join Date: May 2009
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Sleeping_Troll is an unknown quantity at this point
inserting elements, only works with empty parents.

(Prototype 1.6)

I have the following menu building script:
Code:
function init(){
  for(i=0;i<10;i++){
    menuItems[i]=[];
    menuItems[i].Span=new Element("span",{id:"item"+i});
    $("menu").insert(menuItems[i].Span);
    for(j=0;j<10;j++){
      linkSet[i,j]=[];
      linkSet[i,j].Div=new Element("div",{id:"sub"+j});
      $("item"+i).insert(linkSet[i,j].Div);
   }		
}
Go to this url: http://huduzu.trollnest.com/index1.php

In firebug -> HTML <body>, "content", "menu" You will notice that "item0" and "item1" (which have content) have no children! While "item2" - "item9" (no content) have the children inserted in the script! What am I doing wrong?

The content is created in this script:

Code:
function menuValues(){
  $("item0").textContent="	Webmaster ";
  $("item1").textContent="	Item ";
}
It seems that what is happening here is that when I create the content for "item0" and "item1", I am wiping out the child elements. Any DOM experts out there?
Sleeping_Troll is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 06:33 PM.


Advertisement
Log in to turn off these ads.