473,557 Members | 2,830 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Append Child working in Mozilla but not in IE.

dmjpro
2,476 Top Contributor
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.create Element, can it be added into any another document. I think that's what happening here ... ;)
May 6 '09 #1
5 4695
Ciary
247 Recognized Expert New Member
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 Recognized Expert Moderator MVP
You need to use imporNode.
May 6 '09 #3
dmjpro
2,476 Top Contributor
@Ciary
Here you directly setting the innerHTML. I am talking about the document.create Element ;)
May 6 '09 #4
dmjpro
2,476 Top Contributor
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 Recognized Expert Moderator MVP
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
12065
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 stay on top of the parent window no matter where the focus is (so that when you click the parent, the child doesn't *disappear* because if its...
13
4141
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 get *9*. In the example table, there are 4 rows with 4 columns each in the tbody. I'd expect 4 child nodes for the table body with 4 children each. I...
9
36941
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 do I structure document.getElementById('num1').removeChild(image_display); ? <input type=file name="picture1" onChange="image(this.value,...
2
4540
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 IFRAME. I've got several months of javascript under my belt and can resolve most things without errors in my Mozilla Javascript Console, but this...
3
23939
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
2352
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 in the subform). The code in the form is this: Private Sub Form_AfterInsert() If Me.strWholeStr = 0 Then DoCmd.SetWarnings False
2
4118
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 of the similar structure. Problem: When main table is append to the new table, it will bear a new ID.
4
3168
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 && window.event.clientY <-80 ) { if (win2 && !win2.closed) // win 2 is the child window
1
4710
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 = "<Condition id="Custom1" name="Custom1" Selected="T">Coverage Any (New_Zealand) AND Program_Type Any (program1) AND Agreement_Type Any (Agreement1) AND...
0
7549
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...
0
7830
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. ...
0
6180
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5454
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...
0
5172
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...
0
3599
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...
0
3577
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
867
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...

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.