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

Home Posts Topics Members FAQ

children, childNodes problem in netscape

27 New Member
hi,
Children element in javascript is not working in netscape. But is working fine in IE. ChildNodes element is also not working in Netscape. But it is working fine in
IE.

My code is look like this,
Expand|Select|Wrap|Line Numbers
  1. function fSetSelectedDay(my)
  2. {
  3. alert(parseInt((my).childNodes("dateText").innerHTML));
  4. alert((myElement.children["calDateText"].innerText));
  5. //these two codings are working fine in the IE but not in Netscape
  6. }
  7.  
Anyone help me for this.
This is vary helpful for me.
Feb 19 '08 #1
4 3901
acoder
16,027 Recognized Expert Moderator MVP
innerText is not supported by most browsers. Have you tested in Mozilla/Firefox? What about others such as Opera, Safari, etc.?

Show how this code is called and what "my" is.
Feb 19 '08 #2
deepthisoft
27 New Member
This is my code
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3. <script language=javascript>
  4. function fSetSelectedDay(my)
  5. {
  6. alert((my).childNodes("calDateText").innerHTML);
  7. alert(my.children["calDateText"].innerHTML);//It returns the value 5
  8. }
  9.  
  10. </script>
  11. <table>
  12. <tr>
  13. <td  valign='top'  id=calCell onclick=fSetSelectedDay(this)>
  14.  
  15. <font id=calDateText >5</font>
  16. </td>
  17. <tr>
  18. </table>
  19. </body>
  20. </html>
  21.  
This code is working fine in IE and Opera but not in Netscape and Firefox.

Thanks in advance.
Feb 20 '08 #3
mrhoo
428 Contributor
Please excuse this post-
Feb 20 '08 #4
rohitchawla
85 New Member
the way you are calling the childnodes is not correct but it still works in IE

try these out

Expand|Select|Wrap|Line Numbers
  1. function fSetSelectedDay(my)
  2. {
  3.     for(i=0;i<my.childNodes.length;i++)
  4.     {
  5.         if(my.childNodes[i].id=='calDateText')
  6.         {
  7.             alert(my.childNodes[i].innerHTML);
  8.             break;
  9.         }
  10.     }
  11. }
  12.  
or this one if u dont know id
Expand|Select|Wrap|Line Numbers
  1. function fSetSelectedDay(my)
  2. {
  3.     for(i=0;i<my.childNodes.length;i++)
  4.     {
  5.         if(my.childNodes[i].nodeName=='FONT')
  6.         {
  7.             alert(my.childNodes[i].innerHTML);
  8.             break;
  9.         }
  10.     }
  11. }
  12.  
Feb 20 '08 #5

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

Similar topics

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 /*
2
2234
by: DaRik | last post by:
Hi, I'm having some difficulties with a menu I'm making. I build up the menu through DOM. I append childnodes to a tree. 2 types of children are possible: url (a hyperlink) and sub (a submap). The tree is thus of a structure main |-url1
3
2093
by: Wim Roffal | last post by:
I am having a <div> with <a>s and <div>s inside it. I am trying to read in all the elements in the right order. With mydiv.getElementsByTagName("a") I can get the elements of a specific tag like "a", but I want all types. I tried getChildNodes but that doesn't seem to be widely supported. childNodes seemed to do something but I couldn't get it working when I wanted to browse through the elements.
1
12287
by: Todd Cary | last post by:
In my previous post, I stated that some JavaScript I inherited does not work in Firefox but does work in IE 6 . I have now isolated a line where it fails in Firefox; the line with the property of "children". function InitMenu() { if (document.all) { } else
6
2308
by: Ron Brennan | last post by:
Good evening. <span id=fileList> <input type=hidden name=file id=file_0 value=Name/> </span> .... document.getElementById(fileList).childNodes The childNodes is giving me two children: 1) file_0 and 2) undefined.
6
13378
by: Luke Dalessandro | last post by:
I'm not sure if this is the correct forum for platform specific (Mozilla/Firefox) javascript problems, so just shout and point me to the correct newsgroup if I'm being bad. Here's the deal... html file (generated using .NET 2.0 beta2): <form method="post" action="Test2.aspx" id="form1">
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
3
27599
by: Andrej Pavlovic | last post by:
Hi, Please look at the following HTML snippet: <body> some text <p>more text</p> even more text </body>
4
2853
by: Andrew May | last post by:
This is only my first AJAX based application so this may be a trivial question but I cannot find any way of getting at the data I want. So, I have an XML file of the form: <data> <dataelement// one or more instances of this
0
9483
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,...
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...
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
5386
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...
0
5514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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.