473,782 Members | 2,554 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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><IM G height=14 alt=Required
src=\"/images/ci/icons/required.gif\" width=7 border=0
vAlign=\"top\"> <INPUT id=anchor6x width=0 size=10
readonly=\"read only\"></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=\"VISIBIL ITY: visible\" _extended=\"tru e\">
<TABLE>
<TR>
<TD id=td6x vAlign=top align=right><IM G height=14 alt=Required
src=\"/images/ci/icons/required.gif\" width=7 border=0
vAlign=\"top\"> <INPUT id=anchor6x width=0 size=10
readonly=\"read only\"></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=\"tru e\"> "

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.create Element("td");
tdChildEl.align = "right";
tdChildEl.vAlig n = "top";
tdChildEl.id = "td" + indx + "x";
var imgelem = document.create Element('img');
imgelem.src = "/images/ci/icons/required.gif";
imgelem.alt = "Required";
imgelem.vAlign = "top";
imgelem.border = "0";
imgelem.height = "14";
imgelem.width = "7";
tdChildEl.appen dChild(imgelem) ;

var inputChildEl = document.create Element("input" );
inputChildEl.ty pe = "text";
inputChildEl.na me="date" + indx;
inputChildEl.va lue = $('lda' + indx + 'x').value;
inputChildEl.id = anchorName;
inputChildEl.on mouseout = ModifyGrades.ha ndlemouseout;
inputChildEl.on mouseover = ModifyGrades.ha ndlemouseover;
inputChildEl.on click = ModifyGrades.da teSelect;
inputChildEl.wi dth = "10em";
inputChildEl.si ze = 10;
inputChildEl.se tAttribute("rea donly","readonl y");

tdChildEl.appen dChild(inputChi ldEl);
var rowelem = document.create Element('tr');
rowelem.appendC hild(tdChildEl) ;

var aChildEl = document.create Element("a");
aChildEl.href = "#ignore" + indx;
aChildEl.name = anchorName;
aChildEl.id = "url" + anchorName;
aChildEl.onclic k = function(){
ModifyGrades.ca llCalendarIcon( document.forms[0]["date"+indx], "url" +
anchorName); return false; }
var calImgEl = document.create Element('img');
calImgEl.src = "/images/ci/icons/calendar_s.gif" ;
calImgEl.vAlign = "bottom";
calImgEl.border = "0";
aChildEl.append Child(calImgEl) ;
tdChildEl = document.create Element('td');
tdChildEl.appen dChild(aChildEl );
rowelem.appendC hild(tdChildEl) ;

var tableelem = document.create Element('table' );
tableelem.appen dChild(rowelem) ;
span.appendChil d(tableelem);
span.style.visi bility="visible ";
Any idea on what I might be doing wrong?

Thank you for any help.

Apr 27 '06 #1
2 2375
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.javas cript 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.c om/FAQ>
Apr 28 '06 #3

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

Similar topics

1
2225
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 folder name. When certain actions are performed by the user, more folders (spans) are dynamically added using javascript function appendChild(). I add a new folder span to a container span which holds the whole tree.
1
4333
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 want to make first text as Table Heading/menu category. For examle in the given menu i want to make a heading as "Comp. Languages" which won't be a link. 2) The position of this menu is absolute to the page. I want to make it absolute to the Table...
3
3163
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 row has been added is itself contained within an outer table (to handle the desired screen layout). That outer table does not properly grow to contain the new size of the table to which the row was added. (More specifically, I have...
4
3628
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 = document.createElement("td");
3
2442
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 in HTML>. The data is getting updated properly. but whenever the value is refreshed, the HTML page flickers. How do i avoid this flickering.. below is my html page <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
1
2239
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 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
3
1626
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 display more rows on a page.) When the user clicks on the cell (or maybe hovers the mouse over it) then I want the cell to expand to display all of the rows. Can someone help me out as to how I implement it? I've been told to use expanding DIVs but I...
7
6672
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 tabcontainer which has 1 panel already, however I want to try create the TabPanels dynamically. I followed the advice here: http://www.asp.net/learn/ajax-videos/video-156.aspx (3rd comment - Joe Stagner)
6
2895
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 rows in this beside sum i need to sum of the tax for ex: in column1 i added 300 and into 2-nd column i Chose 10% i would like when i chose from drop down box 10% Let in the 2-nd column appear 10% of the value which i addee first column for ex...
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10308
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10143
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9939
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7486
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6729
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5507
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4040
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2870
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.