473,396 Members | 2,013 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.

getting the id of a given child, doesnt work in ff but does in safari

in firefox the following alert does not get created from my function:

ch = container1.childNodes(0).id;
alert(ch)

can anyone tell why this might not work in firefox but does in safari?

thanks

marc

May 15 '07 #1
4 1534
libsfan01 wrote:
in firefox the following alert does not get created from my function:

ch = container1.childNodes(0).id;
childNodes is a list, not a function - some browsers are confused about
that:

var ch = container1.childNodes[0].id;
--
Rob
"We shall not cease from exploration, and the end of all our
exploring will be to arrive where we started and know the
place for the first time." -- T. S. Eliot
May 15 '07 #2
On May 15, 11:31 am, libsfan01 <mcyi2...@googlemail.comwrote:
in firefox the following alert does not get created from my function:

ch = container1.childNodes(0).id;
alert(ch)

can anyone tell why this might not work in firefox but does in safari?
Are you getting an error in the console?

---
Geoff

May 15 '07 #3
ASM
Geoffrey Summerhayes a écrit :
On May 15, 11:31 am, libsfan01 <mcyi2...@googlemail.comwrote:
>in firefox the following alert does not get created from my function:

ch = container1.childNodes(0).id;
alert(ch)

can anyone tell why this might not work in firefox but does in safari?
Why it could work in Safary I don't know,
but why it doesn't work in FF :
because the first chidNode in FF is an invisible text node (without id)
and anyway ... it is :

ch = container1.childNodes[0];
Are you getting an error in the console?
He can also have a look in Firefox's DOM inspector ( #text )

test :
======
ch = container1.childNodes[0];
alert(ch.nodeName);

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
May 15 '07 #4
On May 15, 12:45 pm, ASM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
Geoffrey Summerhayes a écrit :
On May 15, 11:31 am, libsfan01 <mcyi2...@googlemail.comwrote:
in firefox the following alert does not get created from my function:
ch = container1.childNodes(0).id;
alert(ch)
can anyone tell why this might not work in firefox but does in safari?

Why it could work in Safary I don't know,
but why it doesn't work in FF :
because the first chidNode in FF is an invisible text node (without id)
and anyway ... it is :

ch = container1.childNodes[0];
Actually the absence of id wouldn't cause a problem for this,
FF would show 'undefined' in the alert box. Round brackets
as opposed to square definitely are the culprit.
Are you getting an error in the console?

He can also have a look in Firefox's DOM inspector ( #text )
Depends a lot on what container1 is, a text node isn't always
the first child.

But it's always a good idea to learn to use the tools that are
there to make the job easier.

---
Geoff

May 15 '07 #5

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

Similar topics

7
by: KK | last post by:
Please help! I am currently experiencing a bug in Safari v125.9. When I modify the value of form input box and then get the innerHTML property of the surrounding div object - I am returned the...
21
by: Michael Bierman | last post by:
Please forgive the simplicy of this question. I have the following code which attempts to determine the color of some text and set other text to match that color. It works fine in Firefox, but does...
3
by: James Spibey | last post by:
Hi, I have an MDI application which has aboout 10 child windows. The way the app needs to work is that only one window should be visible at a time and it should be maximized within the parent...
9
by: turnitup | last post by:
Given the id of a tr, does anyone know how to get a value of a td of that tr?
12
by: effendi | last post by:
I wrote the following function and tested it in MSIE, Firefox and Mac Safari, Works in all but the Safari. What can I do to rectify this? function processBackground(){ for (n=1;n<11;n++) { ...
2
by: effendi | last post by:
Hi I tested the following function in Safari and it doesnt work. This is tested fine in IE. function processOutcome(){ mainDatabase=document.forms.AssessDatabase.value var...
1
by: wlevins | last post by:
I have a simple script which has worked flawlessly for years - it copies a bit of data from a child window down into a form field in the parent window that opened the child. But now in Firefox 2.0...
7
by: GTalbot | last post by:
Hello fellow authoring.stylesheets colleagues, Can someone please explain why the bottom margin of the last inflow block-level child in an overflowed parent should not have its margin reachable....
29
by: Chris Riesbeck | last post by:
I have an image with a class and the class defines a clip rectangle. In Firefox 2 and 3, and Opera 9, I can access the rectangle with document.defaultView.getComputedStyle(). But that doesn't...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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.