473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

table added dynamically to div span on ie doesn't appear

I am dynamically generating a table in IE to display some information.
I will probably change it to divs later, but I just want to get it
working properly first.

In my div I have the following as the value of innerHTML:
"<TABLE>
<TR>
<TD id=td6x vAlign=top align=right><IMG height=14 alt=Required
src=\"/images/ci/icons/required.gif\" width=7 border=0
vAlign=\"top\"><INPUT id=anchor6x width=0 size=10
readonly=\"readonly\"></TD>
<TD><A id=urlanchor6x href=\"#ignore6\"><IMG height=24
src=\"/images/ci/icons/calendar_s.gif\" width=24 border=0
vAlign=\"bottom\"></A></TD></TR></TABLE>"

But, when I exit the function that generated this, there is nothing
displayed in IE, for what I wanted added.
This is the innerHTML value for the parent of the div above:

"<A name=#ignore6></A>
<DIV id=datespan6 style=\"VISIBILITY: visible\" _extended=\"true\">
<TABLE>
<TR>
<TD id=td6x vAlign=top align=right><IMG height=14 alt=Required
src=\"/images/ci/icons/required.gif\" width=7 border=0
vAlign=\"top\"><INPUT id=anchor6x width=0 size=10
readonly=\"readonly\"></TD>
<TD><A id=urlanchor6x href=\"#ignore6\"><IMG height=24
src=\"/images/ci/icons/calendar_s.gif\" width=24 border=0
vAlign=\"bottom\"></A></TD></TR></TABLE></DIV><INPUT id=lda6x
type=hidden _extended=\"true\"> "

Everything works fine in Firefox 1.5, but not in IE.

This is the code that generated the table:
var anchorName = "anchor" + indx + "x";
var tdChildEl = document.createElement("td");
tdChildEl.align = "right";
tdChildEl.vAlign = "top";
tdChildEl.id = "td" + indx + "x";
var imgelem = document.createElement('img');
imgelem.src = "/images/ci/icons/required.gif";
imgelem.alt = "Required";
imgelem.vAlign = "top";
imgelem.border = "0";
imgelem.height = "14";
imgelem.width = "7";
tdChildEl.appendChild(imgelem);

var inputChildEl = document.createElement("input");
inputChildEl.type = "text";
inputChildEl.name="date" + indx;
inputChildEl.value = $('lda' + indx + 'x').value;
inputChildEl.id = anchorName;
inputChildEl.onmouseout = ModifyGrades.handlemouseout;
inputChildEl.onmouseover = ModifyGrades.handlemouseover;
inputChildEl.onclick = ModifyGrades.dateSelect;
inputChildEl.width = "10em";
inputChildEl.size = 10;
inputChildEl.setAttribute("readonly","readonly");

tdChildEl.appendChild(inputChildEl);
var rowelem = document.createElement('tr');
rowelem.appendChild(tdChildEl);

var aChildEl = document.createElement("a");
aChildEl.href = "#ignore" + indx;
aChildEl.name = anchorName;
aChildEl.id = "url" + anchorName;
aChildEl.onclick = function(){
ModifyGrades.callCalendarIcon(document.forms[0]["date"+indx], "url" +
anchorName); return false; }
var calImgEl = document.createElement('img');
calImgEl.src = "/images/ci/icons/calendar_s.gif";
calImgEl.vAlign = "bottom";
calImgEl.border = "0";
aChildEl.appendChild(calImgEl);
tdChildEl = document.createElement('td');
tdChildEl.appendChild(aChildEl);
rowelem.appendChild(tdChildEl);

var tableelem = document.createElement('table');
tableelem.appendChild(rowelem);
span.appendChild(tableelem);
span.style.visibility="visible";
Any idea on what I might be doing wrong?

Thank you for any help.

Apr 27 '06 #1
2 2350
James Black said the following on 4/27/2006 1:22 PM:
I am dynamically generating a table in IE to display some information.
I will probably change it to divs later, but I just want to get it
working properly first.
<snip>
Any idea on what I might be doing wrong?


You can't appendChild a TR to a TABLE tag, you have to append it to a
TBODY and IE won't let you do it any other way.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 27 '06 #2
Randy Webb said on 28/04/2006 9:34 AM AEST:
James Black said the following on 4/27/2006 1:22 PM:
I am dynamically generating a table in IE to display some information.
I will probably change it to divs later, but I just want to get it
working properly first.

<snip>
Any idea on what I might be doing wrong?

You can't appendChild a TR to a TABLE tag, you have to append it to a
TBODY and IE won't let you do it any other way.


var oRow = table.insertRow(-1);
:-)

--
Rob
Group FAQ: <URL:http://www.jibbering.com/FAQ>
Apr 28 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: antishok | last post by:
Hi, I'm writing a page which has a somewhat similar folder tree to that of the windows explorer, where each folder is made of a <SPAN> tag consisting of the folder image (closed or open) and the...
1
by: ajay | last post by:
I have following code for a slide menu but i twiked it to work for a single level menu. Open it in a Browser to get a clear picture. I have 2 Qs 1) How to make first entry as non-link. i.e i...
3
by: daveland | last post by:
I am working on some JavaScript that dynamically adds rows to a table in response to a button click. A new row does appear on the screen when the button is clicked. However, that table to which a...
4
by: John | last post by:
In my script <script language="javascript"> function AddItinerary() { var newRow; var newCell1,newCell2,newCell3,newCell4,newCell5,newCell6; newRow = document.createElement("tr"); newCell1...
3
by: vanisathish | last post by:
Hi I am running a client side javascript timer to periodically refresh the contents of some tables in the HTML page. The table values are dynmically binded from XML DOM object using the <XML tag...
1
by: James Black | last post by:
I am dynamically generating a table in IE to display some information. I will probably change it to divs later, but I just want to get it working properly first. In my div I have the following...
3
by: chris f | last post by:
In my table (ASP.NET 2) that is dynamically generated I have a cell that initially will only display N rows of text and hide the rest. (This is so that the rows have a small height and I can...
7
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a...
6
by: azegurb | last post by:
Hello, I have one question again i created one table again and in this table i added some another options for ex at the previous table there were only one problem sum of the dynamically added...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.