Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can't display table

Status
Not open for further replies.

Geminist

Programmer
Jul 6, 2002
25
CN
the problem is:
i created a div element with document.createElement()
than i created a talbe element,with all its' trs and tds and append it to the div's child nodes.
but the table cannot be displayed

here is the source code
function createTable(rownum,colnum)
{
tableobj=document.createElement("TABLE");
for(i=1;i<=rownum;i++)
{
trobj=document.createElement(&quot;TR&quot;);
for(j=1;j<=colnum;j++)
{
tdobj=document.createElement(&quot;TD&quot;);
tdobj.id=&quot;c&quot;+i+j;
trobj.appendChild(tdobj);

}
tableobj.appendChild(trobj);
}
tableobj.id=&quot;inputtable&quot;;
return tableobj;
}


function createPanel(panelwidth,panelheight)
{
clearAll();
panelobj=document.createElement(&quot;DIV&quot;);
panelobj.id=&quot;inputpanel&quot;
panelobj.style.backgroundColor=&quot;#ffee00&quot;;
panelobj.style.position=&quot;absolute&quot;;
panelobj.style.width=panelwidth;
panelobj.style.height=panelheight;
panelobj.style.left=event.clientX+document.body.scrollLeft;
panelobj.style.top=event.clientY+document.body.scrollTop;
panelobj.style.visibility=&quot;visible&quot;;
return panelobj;

}


function selectitem16()
{
var panelobj=createPanel(200,100);

tableobj=createTable(2,5);
tableobj.width=100;
tableobj.height=50;
tableobj.border=2;

panelobj.appendChild(tableobj);

document.body.appendChild(panelobj);
}

THANK YOU VERY MUCH IF U CAN HELP ME!



 
Well, if you comment out the
Code:
ClearAll()
and the
Code:
event.ClientX/event.ClientY
lines it'll work in Mozilla, but it still won't work in IE.

Much weirdness.
 
You'll need a tbody element for it to work in IE.

Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top