473,405 Members | 2,421 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,405 software developers and data experts.

Append Child working in Mozilla but not in IE.

dmjpro
2,476 2GB
Have a look at my code fragment...

Expand|Select|Wrap|Line Numbers
  1. var parent_UL_ref = parent.document.getElementById(..);
  2. var child_LI_ref = document.createElement('LI');
  3. parent_UL_ref.appendChild(child_LI_ref); //it's not working
  4.  
Actually my question is if create an element using document.createElement, can it be added into any another document. I think that's what happening here ... ;)
May 6 '09 #1
5 4690
Ciary
247 Expert 100+
normally there shouldnt be a problem with it. i'm doing the same in my current project. only there i create divs containing dynamically created paragraphs.

another option:
Expand|Select|Wrap|Line Numbers
  1. var parent_UL_ref = parent.document.getElementById(..);
  2. var parent_UL_ref .style.innerHTML += "<li>item</li>
  3.  
May 6 '09 #2
acoder
16,027 Expert Mod 8TB
You need to use imporNode.
May 6 '09 #3
dmjpro
2,476 2GB
@Ciary
Here you directly setting the innerHTML. I am talking about the document.createElement ;)
May 6 '09 #4
dmjpro
2,476 2GB
Well i got the solution...

I have a opener window and a pop-up window, and there code given below.

Expand|Select|Wrap|Line Numbers
  1. //onload function
  2. function openPopUp(){
  3.  window.open(......);
  4. }
  5.  
Expand|Select|Wrap|Line Numbers
  1. //add-list handler
  2. function addList(){
  3.  var parent_UL_ref = opener.document.getElementById(..) ; //get the opener UL reference
  4.  var child_LI_ref = document.createElement('LI');
  5.  parent_UL_ref.appendChild(child_LI_ref); //here it says no such interface supported
  6. }
  7.  
Up to this the whole code works in Mozilla but not in IE.

if i change the code like this ....
Expand|Select|Wrap|Line Numbers
  1. var child_LI_ref = opener.document.createElement('LI');
  2.  
Then it works in both ;)
May 6 '09 #5
acoder
16,027 Expert Mod 8TB
If you're going to stick to the same document, then it will work. If not, you should be using importNode, but unfortunately, it's not been implemented in IE though you can find versions online.
May 6 '09 #6

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

Similar topics

6
by: Cortes | last post by:
Hi all, I have this parent window poping up the child window. SOmething like this popupWinA= window.open("child.html","popupWinA"," width=300 , height=150) I want this child popupWinA always...
13
by: kaeli | last post by:
Can anyone explain this to me? It's driving me insane. Save this and run it in IE or Opera and then in Mozilla or Netscape 6+. In IE/Opera, I get the expected 4 alerts. In Mozilla/Netscape, I...
9
by: Ken | last post by:
I am trying to create one image using JavaScript; then later in the script remove the image - not just remove the src. The following creates the image, but I have been unable to remove it. How...
2
by: Randell D. | last post by:
Folks, I have got this working before, in part with some help from this ng but I never really understood how I got it working... and last time, I was using it via a popup window as opposed to an...
3
by: Jonathan Buckland | last post by:
Can someone give me an example how to append data without having to load the complete XML file. Is this possible? Jonathan
1
by: James Hallam | last post by:
I have a form with a subform. When there are no entries in the subform, I have an append query which makes a default entry in the subform (for what I am doing there needs to be at least one value...
2
by: sj | last post by:
Situation: I have 2 tables, parent table (Invoice) and child table (InvoiceDetails) that is link by InvID in the child. Requirement: Need to do one-time append of information to another table...
4
by: reemamg | last post by:
From a parent window a new child window is open with window.open <script type="text/javascript" language="JavaScript" > function abc() { if(window.event.clientY <0 &&...
1
by: GuruPrasadBytes | last post by:
I have two objects and their types listed below in javascript. 1st one is parentNode type IXMLDOMElement 2nd is child Node type IXMLDOMElement parentNode.xml = "<Security/>" childNode.xml =...
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: 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
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...
0
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
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.