473,387 Members | 1,789 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,387 software developers and data experts.

Error when using the appendChild method with IE6

Hello EveryOne,

I have a problem with ie6 when using the appendChild method.
I have tested my code on ie8, FireFox and chrome and I don't have any problem.
I give you the code:

Expand|Select|Wrap|Line Numbers
  1. pic = new Image();
  2. pic.id = "img_thumb_"+id;
  3. //pic.name = "img_thumb_"+id;
  4. pic.src = "get_mini_image.php?archId="+id;
  5. pic.style.display = "block";
  6. pic.style.position = "absolute";
  7. pic.style.top = "10%";
  8. pic.style.left = "64%";
  9. parent.document.getElementById("id_DIV").appendChild(pic);
Thank you in advance for your help
Dec 9 '09 #1

✓ answered by acoder

The problem is you're creating the element in this document and then appending to the parent document. Use parent.createElement(...) to create the element and append.

10 4135
Dormilich
8,658 Expert Mod 8TB
I suspect the call window.parent.document not to work. btw. what is the error message?
Dec 9 '09 #2
I'm sure that the cause of my error is the appendChild method. [ I tried not to use it, I don't have an error message]
The messag of error is : Invalid Argument.
Dec 9 '09 #3
Dormilich
8,658 Expert Mod 8TB
seems like IE6 requires an Element/HTMLElement as input (i.e. created with the document.createElement() method)
Dec 9 '09 #4
I have tried this alternative:
var pic = document.ceateElement("IMG");
I still have the same error.
I don't understand what wrong when using appendChild with ie6 !!!!
I don't have any error with ie8 !!!!
Dec 9 '09 #5
Dormilich
8,658 Expert Mod 8TB
well, this is beyond my abilities, since I don’t have IE to test myself. ;_;
Dec 9 '09 #6
thank you for your intrest.
If you would like to test, you can download IETester, it is a free application allowing developpers to test their code with all IE version.
You can find it in : http://ietester.softonic.fr/telecharger
Dec 9 '09 #7
Dormilich
8,658 Expert Mod 8TB
unfortunately this requires a Windows operating system… and I’m running on freeBSD.
Dec 9 '09 #8
acoder
16,027 Expert Mod 8TB
The problem is you're creating the element in this document and then appending to the parent document. Use parent.createElement(...) to create the element and append.
Dec 11 '09 #9
thank you so much acoder, it's the solution for my problem
Dec 13 '09 #10
acoder
16,027 Expert Mod 8TB
Cool. Glad you got it working.
Dec 14 '09 #11

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

Similar topics

1
by: Andrew Poulos | last post by:
I'm dynamically building some html OBJECT code and I use this function to and PARAM elements: // function to add a PARAM element to an element (parent, name, value) addParam = function(prt,n,v)...
7
by: debugger | last post by:
hello, Question, on page load, I populate an existing drop down with createElement and appendChild. It works fine so far. BUT I want to automatically select some option from this populated drop...
7
by: meaneyedcat | last post by:
When I call addField(), my table appears to be populated correctly with a new row in the table with all the required fields. However, when I call delete row on any new rows that have been created,...
10
by: RodBillett | last post by:
Using SmartNavigation. Windows2003 Server Framework 1.0 (3705) IIS6 and I have IIS configured to utilize the 1.0 framework. Any Ideas why I would be getting the following jscript error within...
0
by: Luis Esteban Valencia | last post by:
Hello I have this error when I submit the page with the following code. I had never see this kind of errors. Thanks private void btnsubmit_Click(object sender, System.EventArgs e) { ...
2
by: Bluesangig | last post by:
Hi all, I am trying to append a TABLE element (being created dynamically) to an existing DIV element in a HTML document. But when trying to do so it is giving me the following error: Line: 141...
3
by: suganya | last post by:
Hi Some professionals already has developed the project using menu. In my company, they have given me task to clear the error in that. It is a script file named as "menubarAPI4.js" which is kept...
4
by: =?Utf-8?B?VG9yZW4gVmFsb25l?= | last post by:
Was editing code, am getting the following errors } expected Type or namespace definition, or end-of-file expected Eyes crossed cannot find code below! using System; using...
7
by: svpriyan | last post by:
Dear Buddies, I have two Java Prog: My task is to read the Content of the file and write to an XML file. so i started doing it perfectly... What i have problem is when i tried to execute the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...

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.