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

IE vs Firefox first row in the table

Hi there. I'm having a problem in which Firefox views the 1st row of a table as rows[0], but IE is saying there is no rows[0] and the first row is rows[1].

What is possibly going on here?

Here is the code I use.

document.getElementById('dynTable').rows[i].cells[0].firstChild.value;

If I set i = 0, then IE returns me an 'error Object required'. However the same code in Firefox works fine. I then set i = 1 then IE works fine, but Firefox does not work.
Mar 10 '08 #1
4 1666
Hi there. I'm having a problem in which Firefox views the 1st row of a table as rows[0], but IE is saying there is no rows[0] and the first row is rows[1].

What is possibly going on here?

Here is the code I use.

document.getElementById('dynTable').rows[i].cells[0].firstChild.value;

If I set i = 0, then IE returns me an 'error Object required'. However the same code in Firefox works fine. I then set i = 1 then IE works fine, but Firefox does not work.

I found the problem. I can't use document.getElementById('dynTable')..


I declared my table as follows:

theTable = (document.all) ? document.all.dynTable :
document.getElementById("dynTable")
theTableBody = theTable.tBodies[0]

And the code that works in both browsers is

theTableBody.getElementById('dynTable').rows[i].cells[0].firstChild.value;

Does anyone know why this works, but my initial code does not?
Mar 10 '08 #2
acoder
16,027 Expert Mod 8TB
Does anyone know why this works, but my initial code does not?
Show the HTML code for the table.
Mar 10 '08 #3
rnd me
427 Expert 256MB
it depends on your doctype i believe. with some combinations of doctypes and browsers, tbodies are virtually added, or not.
Mar 10 '08 #4
acoder
16,027 Expert Mod 8TB
theTableBody.getElementById('dynTable').rows[i].cells[0].firstChild.value;
getElementById() is a method of document, not a TBODY object.
Mar 11 '08 #5

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

Similar topics

5
by: uberderf | last post by:
I have the following web page setup: http://angels.uberderf.com/glossary.html I have a 2 column table layout which is a glossary of terms and their meanings. When you view this page in firefox...
4
by: Stuart Perryman | last post by:
Hi, I have the following code which works just fine in IE6 but not in Firefox. It is an extract of several table rows each with an individual form. It is generated by php. <form...
14
by: Karin Jensen | last post by:
Hi - I am trying to use Javascript to put material inside a table (i.e. alongside the previous material) if the user's screensize is big enough and outide the table (beneath table) if it isn't. ...
12
by: VK | last post by:
http://www.mozilla.com
11
by: Ben Holness | last post by:
Hi all, I am having some trouble with some table code. It works fine in Internet Explorer, but the layout doesn't work correctly in Firefox 1.0.7 Is this a firefox bug, or am I missing...
6
by: Giggle Girl | last post by:
I have an embedded style sheet that works perfect in IE6, and looks wrong in Firefox 1.7. Here is a link to an online sample: http://c.1asphost.com/giggy/tree02h/main/default.htm It works for...
7
by: mattrapoport | last post by:
Hello - I am kinda new to the HTML DOM so I apologize in advance for my ignorance. I have a table made from divs. I am trying to write a script that appends a new row to the table (by cloning...
3
by: patrickkellogg | last post by:
I have this code when you click the buttom is suppose to add a job history. it works with firefox, opera, but not ie. (please note - new entries don't have all the elements in them yet, but...
2
by: cbjewelz | last post by:
Hey all. So I'm having problems with cross browser alignments. I'm looking at Safari and Mozilla Firefox. I develop in Safari and so it looks perfect there however in Firefox my vertical...
3
by: töff | last post by:
On my site http://www.sjcga.com I have a javascript-generated navigation menu in the top right corner. The menu works great in IE and Opera ... but in FireFox, on the 1st click, the menu jumps...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
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...
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...

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.