473,785 Members | 2,308 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is "children" a valid property in Firefox?

In my previous post, I stated that some JavaScript I inherited does not
work in Firefox but does work in IE 6 [in my first post I mixed up the
browsers]. I have now isolated a line where it fails in Firefox; the
line with the property of "children".

function InitMenu()
{
if (document.all["menuBar"])
{
}
else
{
return;
}
document.onclic k=HideMenuBar;
var bar = menuBar.childre n; <-------------<<<
alert("Got to here " + bar.length.toSt ring());

Has anyone else had this problem? Work around?

Many thanks....

Todd
Jul 23 '05 #1
1 12287


Todd Cary wrote:
In my previous post, I stated that some JavaScript I inherited does not
work in Firefox but does work in IE 6 [in my first post I mixed up the
browsers]. I have now isolated a line where it fails in Firefox; the
line with the property of "children".

function InitMenu()
{
if (document.all["menuBar"])
{
}
else
{
return;
}
document.onclic k=HideMenuBar;
var bar = menuBar.childre n; <-------------<<<
alert("Got to here " + bar.length.toSt ring());

Has anyone else had this problem? Work around?


Mozilla implements the W3C DOM, it is documented here for the Core:
<http://www.w3.org/TR/DOM-Level-2-Core/>
and for the HTML stuff here:
<http://www.w3.org/TR/DOM-Level-2-HTML/>
Look there if you want to find properties or methods.

As for children, no, in its DOM nodes do not have a property children,
there is a property childNodes however which is similar but not quite
the same (children only covers element nodes but childNodes text nodes
as well).
But IE 5 and later implement much of the W3C DOM too so using childNodes
for instance with Mozilla and IE (5 and later) is possible.
I would strongly suggest if you are writing script nowadays then you try
to use the W3C DOM first as then you can easily cover IE 5/6, Mozilla
1.x and later, Netscape 6/7, Firefox, Opera 7, Konqueror, Safari.
If you stick with stuff coming from the IE 4 DOM (like document.all or
children) then you will find different support in non IE browsers,
sometimes depending on the version or even the rendering mode. For
instance Mozilla versions before Mozilla 1.7.5 or Firefox 1.0 don't
support document.all while by now (only in quirks mode) undetected
document.all support is added. But that only means that someone using
document.all now with Firefox finds an element but then further IE
specific stuff like children on that element fail.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2

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

Similar topics

4
1986
by: Robin Tucker | last post by:
Hi, I'm currently implementing a database with a tree structure in a table. The nodes in the tree are stored as records with a column called "Parent". The root of the tree has a "NULL" parent. The path to each node is stored in the column "Path" and is of the form "\000001\000002\000003\" etc. The latter enabling me to fetch subtrees using the "LIKE" predicate. I also have created the relation "ID" <-> "ID_Parent, effectively the...
13
3798
by: Julia Peterwitz | last post by:
I have a function that works with explorer but not with netscape. The problem is the function at line 5. 1 fSetSelectedDay(myElement){ 2 /* 3 ... 4 */ 5 var elementText = eval(myElement.children.innerText); 6 /*
24
3531
by: Charles Crume | last post by:
Hello; My "index.htm" page has 3 frames (content, navigation bar, and logo). I set the "SRC" of the "logo" frame to a blank gif image and then want to change it's contents after the other two frames have been loaded by using a javascript statement from the "navigation" frame, as shown below: top.window.ccs_logo.src = 'images/ccs_logo.gif'; alert(top.window.ccs_logo.src);
8
14277
by: Don Wash | last post by:
Hi There! I'm using VB.NET to create a TreeView application and unfortunately I could not find "Key" property in Node items of the TreeView. We used to have "Key" property in TreeView node object in VB6. What is the equivalent of "Key" property of TreeView node in VB.NET? Has the property name "Key" has been changed to something else? Or VB.NET does not support the "Key" property anymore? If so what are the alternatives?
10
11338
by: Angel | last post by:
I have the following code var thisDoc=document.getElementById("myTable"); // myTable is the name of the table alert(thisDoc.childNodes.children.length) How do I change the second line of code for it to work in firefox? Regards, Angel
23
2880
by: codefire | last post by:
Hi, I am trying to get a regexp to validate email addresses but can't get it quite right. The problem is I can't quite find the regexp to deal with ignoring the case james..kirk@fred.com, which is not valid. Here's my attempt, neither of my regexps work quite how I want: import os import re
0
3955
by: Summercool | last post by:
right now i have a script that will add to the DOM tree of a form... adding the hidden input values as children... it works well except when i click "BACK", Firefox doesn't remove those objects... (IE 7 and Safari 3 both removed them). So Firefox will actually submit more objects that there really are. so Firefox (2.0.0.8) is the only one causing trouble... is there a way to "force" refresh of the page or reload it? if i refresh...
5
6487
by: anEchteTrilingue | last post by:
Hi everybody. Thank you for reading my post. I am having trouble getting "this" to work in all versions of IE (it's fine in Firefox, opera, konqueror, etc). What I would like to do is add an event listener to an element to change its border on mouseover and mouseout. I don't want to use CSS to do this (long story). The problem is that "this" does not work at all in IE for me. I tried to do a try/catch statement and use...
2
21090
GaryTexmo
by: GaryTexmo | last post by:
For a project I'm working on I had need of a QuadTree to give me quick and easy access to objects within a given bounds. I learned quite a bit working on it and thought it might be a good idea to share the code with the Bytes community. To use it, create a new QuadTree and tell it what area it's going to cover. Then simply insert objects into it using the Insert method. You can use the Remove method to take objects out. On a removal, if a...
0
10346
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
10157
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...
1
10096
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9956
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
7504
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
6742
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
5514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
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.