469,365 Members | 1,789 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,365 developers. It's quick & easy.

appendChild. Table inside DIV. Doesnt show up

2
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);
Aug 30 '05 #1
1 12567
xaces
2
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.
Aug 30 '05 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by samuel.adam | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.