473,396 Members | 1,702 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,396 software developers and data experts.

Very simple IE InnerHTML problem in a table row.

The following works AMAZING in Firefox. And doesn't work at all in IE.

[HTML]<html>
<body>
<table id="someTable" border="3">
<tr>
<td>Cell 1</td><td>Cell 2</td><td>Cell 3</td>
</tr>
</table>
<script>
// Doesn't works in IE.
var theInner = document.getElementById("someTable").rows[0].innerHTML;
var newRow = document.getElementById("someTable").tBodies[0].insertRow(1);
// And here it crashes...
document.getElementById("someTable").tBodies[0].rows[1].innerHTML = theInner;
</script>
</body>
</html>[/HTML]
Apr 26 '06 #1
1 11447
Banfa
9,065 Expert Mod 8TB
try this Javascript instead

Expand|Select|Wrap|Line Numbers
  1.       var t = document.getElementById("someTable");
  2.  
  3.       var theInner = t.rows[0].innerHTML; 
  4.       var newRow = t.insertRow(1); 
  5.       var newCell;
  6.  
  7.       newCell = newRow.insertCell(0);
  8.       newCell.innerHTML = t.rows[0].cells[0].innerHTML;
  9.  
  10.       newCell = newRow.insertCell(1);
  11.       newCell.innerHTML = t.rows[0].cells[1].innerHTML;
  12.  
  13.       newCell = newRow.insertCell(2);
  14.       newCell.innerHTML = t.rows[0].cells[2].innerHTML;
  15.  
Apr 27 '06 #2

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

Similar topics

4
by: RobG | last post by:
I know you aren't supposed to use innerHTML to mess with table structure, but it seems you can't use it just after a table without damaging the containing element. I added a table to a div using...
18
by: Geoff Cox | last post by:
Hello, I am trying to print out the array values for a second time but get error on page message? Thanks Geoff <html>
1
by: Avi | last post by:
Hi All. This code works very fine in Firefox but not in I.E. Can anybody help me out? it gives ... "Unknown Runtime Error" in I.E. This code ... Stores N*2 Matrix at Client Side & provide the...
3
by: Joe | last post by:
Hi, I have a simple thing I need to do but just doesn't work in VB.NET. I have a string with HTML code and I want to load it into a HTMLDocument object or something similiar to it so I can...
29
by: Knut Olsen-Solberg | last post by:
I try to change the text in a <p> using getElementById(). I wonder what properties exists, and which one to use here. (The following does not work.) Regards Knut ______________________ ...
1
by: huzheng001 | last post by:
I have develop a on-line dictionary website, http://www.stardict.org I meet a problem: Here is two lines of js codes: document.getElementById("wordlist").innerHTML = "";...
7
by: WSPL5 | last post by:
I have done this function before and I cannot figure out why it is not working. I am receiving the results of an xmlhttp call and I am looping through the values I am creating links with an OnClick. ...
3
by: Tarik Monem | last post by:
You guys have been very helpful. Even if the solution was not presented in the reply, then you would at least spark a thought which would lead to the solution and I am very grateful for your...
22
by: giordan | last post by:
Hi all! I've wrote this code: <script type="text/javascript"> var largImg; var altImg; var txtTop = '<b>Ottima scelta!</b> Ora compila il form e premi "Ricevi banner". Il...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.