473,480 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

XMLHttpRequest, innerHTML

I'm using the newly discoverd (to me :) XMLHttpRequest object to grab
content for a page, then using innerHTML to insert the content, like...
myDiv = document.getElementById('somediv');
myDiv.innerHTML = xmlhttp.responseText;

.... it works fine up to a point. The content I'm inserting is a series
of elements, and so they should be accessable as the myDiv.children[]
array. Indeed they are in IE, but they aren't in Firefox. If I try to
get the myDiv.children.length value, I get a correct answer in IE, but
FF gives me 'undefined'. I'd like to be able to access these nodes for
various purposes.

It seems like FF doesn't 'see' the innerHTML in the document tree (is
that the correct term?).

I haven't tried using appendChild to get the elements into their parent
container, because it seems too inneficient. I'd have to take the
responseText and split it into an array of elements, then iterate and
insert. I'm hoping someone can come up with a way to "shake the tree"
into knowing that myDiv has some children.

? TIA,

Jul 23 '05 #1
2 1764
Razzbar wrote:
<snip>
... . The content I'm inserting is a series
of elements, and so they should be accessable
as the myDiv.children[] array.
It is a collection, not an array (similar in some respects, but
different in others).
Indeed they are in IE,
The - children - collection is a Microsoft proprietary feature that is
not universally supported.
but they aren't in Firefox.
Browsers implementing the W3C Core DOM standard, including
Mozilla/Firefox and IE, implement a - childNodes - collection that
performs a similar role to the - children - collector in IE, except that
it is a collection of Nodes rather than Elements (Elements being a
sub-set of Nodes).

<snip> It seems like FF doesn't 'see' the innerHTML in the
document tree (is that the correct term?).

<snip>

In HTML DOMs Firefox supports - innerHTML - dynamically, and
corresponding nodes almost certainly form the containing element's -
childNodes - collection.

Richard.
Jul 23 '05 #2
Thanks, Richard. That clears things up. It works perfectly, and now I
understand why I can't sort the 'array'.

I appreciate the clarification.

Jul 23 '05 #3

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

Similar topics

20
2632
by: chris.schwalm | last post by:
This is part II of this <a...
1
896
by: vikas.khengare | last post by:
Hi Friends.... I have AJAX code which giving "Permission denied to call method XMLHttpRequest.open" error. This error fired by FireFox 1.0 and IE 6 and with Tomacat 5.x. This code work very...
9
2139
by: Phil_Harvey | last post by:
I am redoing my website and trying to get it to do something more exciting using Javascript. I did normal Java at university and code at work in VB.NET. I have got reasonably far into what I want...
6
7240
by: Nathan | last post by:
Can I run two XMLHTTPRequest objects at the same time? Im able to get one to work without problems. If I put a call to a function inside the first ones onreadystatechange function, the 2nd ones...
1
4155
by: mathewda | last post by:
Hey, I'm having a problem that I consider kinda weird that is alluding me at the moment. I've wrote some code that will set up an XMLHttpRequest, it then makes a call to open and send and sets the...
7
3599
by: pamelafluente | last post by:
The precious input given by Laurent, Martin, Benjamin about XMLHttpRequest in Javascript, has made me think that perhaps I could improve what I am currently doing by using Ajax. Let's make it...
1
4010
by: geevaa | last post by:
http://www.phpbuilder.com/columns/kassemi20050606.php3 XMLHttpRequest and AJAX for PHP programmers James Kassemi Introduction: Although the concept isn't entirely new, XMLHttpRequest...
15
6971
by: rage3324 | last post by:
I am posting html onto my main page between div tags using xmlhttprequest and innerhtml. The html I am posting has javascript inside which I am executing using the eval() function. However, the...
7
1760
RMWChaos
by: RMWChaos | last post by:
Bizarro, that's all I can say. Aren't FF2.0.0.8 and NN9 both Mozilla 2 based browsers? So why would the exact same code work in one and not the other? To add insult to injury, it works just fine in...
2
2431
by: gradinafrica | last post by:
I'm trying to create a log out button that uses AJAX to call a php file which ends the current session: //logout.php <?php if (!session_start()); session_destroy(); //Destroys the...
0
7103
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...
1
6758
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
7010
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
5362
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,...
1
4799
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...
0
4499
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...
0
3011
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...
1
572
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
203
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...

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.