Connecting Tech Pros Worldwide Help | Site Map

appendChild. Table inside DIV. Doesnt show up

 
LinkBack Thread Tools Search this Thread
  #1  
Old August 30th, 2005, 11:25 PM
Newbie
 
Join Date: Aug 2005
Age: 27
Posts: 2
Default appendChild. Table inside DIV. Doesnt show up

I am relatively new to javascript.
I am trying to create a menu. I cant get it to show on IE.
The object exists but just wouldnt show up.
Can anyone please help??
Thanks
:confused:

Expand|Select|Wrap|Line Numbers
  1.         var menuDivNode = document.createElement("DIV");
  2.         menuDivNode.id = "thisMenu";
  3.         menuDivNode.align = "center";
  4.         menuDivNode.style.position = "absolute";
  5.         menuDivNode.style.top = "100";
  6.         menuDivNode.style.left = "500";
  7.         menuDivNode.style.width = "100";
  8.         menuDivNode.style.height = "20";
  9.         menuDivNode.style.backgroundColor = "#FFCF06";
  10.         menuDivNode.style.cursor = "hand";
  11.         menuDivNode.style.zIndex = "1";
  12.  
  13.         var tableNode = document.createElement("TABLE");
  14.         tableNode.border = "1";
  15.         tableNode.cellspacing = "1";
  16.         tableNode.cellpadding = "0";
  17.         tableNode.style.borderCollapse = "collapse";
  18.         tableNode.bordercolor = "#FFCF06";
  19.         tableNode.bgcolor = "#FFCF06";
  20.         tableNode.width = "100%";
  21.         tableNode.height = "100%";
  22.  
  23.         var tableRowNode = document.createElement("TR");
  24.         var tableColumnNode = document.createElement("TD");
  25.         var innerDivNode = document.createElement("DIV");
  26.         innerDivNode.style.fontSize = "9";
  27.         innerDivNode.style.backgroundColor = "#FFCF06";
  28.  
  29.         var menuTitle = document.createTextNode("Rate");
  30.  
  31.         innerDivNode.appendChild(menuTitle);
  32.         tableColumnNode.appendChild(innerDivNode);
  33.         tableRowNode.appendChild(tableColumnNode);
  34.         tableNode.appendChild(tableRowNode);
  35.         menuDivNode.appendChild(tableNode);
  36.         document.body.appendChild(menuDivNode);
Reply
  #2  
Old August 30th, 2005, 11:45 PM
Newbie
 
Join Date: Aug 2005
Age: 27
Posts: 2
Default TBODY missing

Figured it out :D
Requires a TBODY object. Usually it works without this tag in HTML but the DOM requires this object to be defined.
Reply
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search


Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.