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. 1 2239
James Black said on 28/04/2006 3:25 AM AEST: 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";
When posting code, indent with 2 or 4 spaces, manually wrap at about 70
characters to prevent auto-wrapping introducing errors.
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;
The use of $(...) indicates the use of prototype.js, it seems you don't
really need it here.
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;
It's not a good idea to use deprecated element attributes, use CSS style
attributes instead. inputChildEl.se tAttribute("rea donly","readonl y");
A recent thread discussed setAttribute vs. direct access to DOM object
properties. Some browsers have issues with setAttribute, so just use:
inputChildEl.re adonly = true; tdChildEl.appen dChild(inputChi ldEl); var rowelem = document.create Element('tr');
1. Create the table here and then the row using:
var tableelem = document.create Element('table' );
var rowelem = tableelem.inser tRow(-1);
For reference:
<URL:http://developer.mozil la.org/en/docs/DOM:table.inser tRow>
See below...
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";
Deprecated attributes again...
calImgEl.border = "0"; aChildEl.append Child(calImgEl) ; tdChildEl = document.create Element('td'); tdChildEl.appen dChild(aChildEl ); rowelem.appendC hild(tdChildEl) ;
More efficient replace the above 3 lines with:
var tdChildEl = rowelem.insertC ell(-1);
tdChildEl.appen dChild(aChildEl ); var tableelem = document.create Element('table' ); tableelem.appen dChild(rowelem) ;
In IE you can't add rows directly to a table using appendChild, you must
add them to a tbody. To save creating a tbody, appending it, etc.
create the table and row as indicated at 1. above using insertRow.
span.appendChil d(tableelem); span.style.visi bility="visible ";
Where is 'span' defined? If it's a span, it can't have a table as a
child - the result of the above may be unpredictable.
There may be other errors, I haven't tested it.
--
Rob
Group FAQ: <URL:http://www.jibbering.c om/FAQ> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: kie |
last post by:
hello,
i have a table that creates and deletes rows dynamically using
createElement, appendChild, removeChild.
when i have added the required amount of rows and input my data, i
would like to calculate the totals in each row.
when i try however, i receive the error:
"Error: 'elements' is null or not an object"
|
by: Toby Austin |
last post by:
I'm trying to replace <table>s with <div>s as much as possible.
However, I can't figure out how to do the following…
<table>
<tr>
<td valign="top" width="100%">some data that will 'stretch'</td>
<td valign="top" width="300">some data that won't 'stetch'</td>
</tr>
</table>
|
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...
|
by: Neal |
last post by:
Patrick Griffiths weighs in on the CSS vs table layout debate in his blog
entry "Tables my ass" - http://www.htmldog.com/ptg/archives/000049.php . A
quite good article.
|
by: Just Dummy |
last post by:
Hi all,
I am struggling with a problem for a long time.
Problem statement:
I have a table and the table can contain n number of rows. i.e., the
table rows will be generataed out of a xml using a xslt. Now the problem
is I want the table to be only with a height of 200px. if this exceeds
beyond 200px, a vertical scroll bar along should appear. The horizontal
| |
by: sheree |
last post by:
I have 3 tables (amoung a few others) in a small access database. The
tables are as follows:
==
AEReport
--------
AEID (PK)
RptCatelog
GCRCID
PatientID
EvntDate
|
by: JohnR |
last post by:
I have a table in a dataset whose fields are bound to various controls on my
form. The records are sorted by primary key so when I use the
currencymanager to navigate the data, it all appears sorted. When I add a
new row to this table and save it (using dataadapter.update) it appears at
the end of the list no matter where it should fall in the sorted list. When
I exit and re-enter the form the newly added record is then presented in the...
|
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
|
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...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
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...
|
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...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |