473,473 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

invalid argument with appendChild

If I try to append a PARAM tag twice I'm having problems:
var.medDiv = document.getElementById("myDiv");

var medObj = document.createElement("object");

var p = document.createElement("param");
p.setAttribute("FileName",this.URL);
medObj.appendChild(p);

p = document.createElement("param");
p.setAttribute("AutoStart","false");
medObj.appendChild(p); // <-- this one

medDiv.appendChild(medObj);
The line with the "this one" comment triggers IE to tell me that it has
an invalid argument. If I change the order of the PARAMs then the new
second PARAM will give me the error. If I move the setAttribute to after
the appendChild I still get the error.

I'm unsure what's wrong.

Andrew Poulos
Jul 23 '05 #1
7 8246
Andrew Poulos wrote:
If I try to append a PARAM tag twice I'm having problems:
var.medDiv = document.getElementById("myDiv");


var medDiv...

Perhaps? Loose the '.' between 'var' and 'medDiv'

[...]

--
Rob
Jul 23 '05 #2
RobG wrote:
Andrew Poulos wrote:
If I try to append a PARAM tag twice I'm having problems:
var.medDiv = document.getElementById("myDiv");

var medDiv...

Perhaps? Loose the '.' between 'var' and 'medDiv'


Dang that was my typing the question out not the code I'm using. That is
the code I'm using does have

var medDiv...

I'm still stuck the second call to appnedChild of a PARAM element
causes IE to choke and I can't fix it.

Andrew Poulos
Jul 23 '05 #3
On Mon, 24 Jan 2005 23:02:06 +1100, Andrew Poulos <ap*****@hotmail.com>
wrote:

[snip]
var p = document.createElement("param");
p.setAttribute("FileName",this.URL);
medObj.appendChild(p);


You aren't setting the attributes properly:

p.name = 'FileName';
p.value = this.URL;

Likewise for the second PARAM element.

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #4
Michael Winter wrote:
On Mon, 24 Jan 2005 23:02:06 +1100, Andrew Poulos <ap*****@hotmail.com>
wrote:

[snip]
var p = document.createElement("param");
p.setAttribute("FileName",this.URL);
medObj.appendChild(p);

You aren't setting the attributes properly:

p.name = 'FileName';
p.value = this.URL;

Likewise for the second PARAM element.

[snip]

When I do setAtribute/appendChild twice it gives me an error in IE 5,
5.5, and 6. If I go the name value pairing/appendChild twice it 'works'
in IE6 but not 5 or 5.5.

I'm beginning to think that IE has trouble with OBJECT tags that are
dynamically added using DOM methods.

Andrew Poulos
Jul 23 '05 #5
Andrew Poulos wrote:
If I try to append a PARAM tag twice I'm having problems:

[...]

Given the above posts, I can only suggest using "var" when declaring
'p' in both instances:

var p = document.createElement("param");
p.name = FileName
[...]

var p = document.createElement("param");
[...]

Alternatively, use a different variable name for the second PARAM
and see if that works.

--
Rob
Jul 23 '05 #6
Fred Oz wrote:
Andrew Poulos wrote:
If I try to append a PARAM tag twice I'm having problems:


[...]

Given the above posts, I can only suggest using "var" when declaring
'p' in both instances:

var p = document.createElement("param");
p.name = FileName
[...]

var p = document.createElement("param");
[...]

Alternatively, use a different variable name for the second PARAM
and see if that works.


Thanks. I tried it, and about a million other things, and it made no
difference. I'm seriously starting to believe that IE does not like
people using DOM methods to dynamically create OBJECT tags.
Andrew Poulos
Jul 23 '05 #7
>
Thanks. I tried it, and about a million other things, and it made no
difference. I'm seriously starting to believe that IE does not like
people using DOM methods to dynamically create OBJECT tags.
Well I should've looked here in the first place:
<url:
http://msdn.microsoft.com/library/de...ppendchild.asp


It seems the OBJECT tag with appendChild is not supported in IE. Sorry
for wasting people's time.

Andrew Poulos
Jul 23 '05 #8

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

Similar topics

25
by: kie | last post by:
hello, i have a table that creates and deletes rows dynamically using createElement, appendChild, removeChild. when i have added the required amount of rows and input my data, i would like to...
8
by: Owen Jenkins | last post by:
Hello. For years I've been using the DBEngine.CompactDatabase code to make backups of backend databases. But now I've struck a baffling problem where I get an Invalid Argument error. This...
7
by: Nadav | last post by:
Hello, When I create an XML header using this code: XmlDeclaration header = doc.CreateXmlDeclaration("1.0", "UTF-8", null); XmlElement rootElement = doc.DocumentElement; ...
1
by: Timbo | last post by:
Hi all, This is my first message here so i'll try and include all the information that will help you help me out, if possible. Basically I am using C# in ASP.NET 2.0 and have a Repeater...
2
by: Nathan Sokalski | last post by:
I have a DataList in which the ItemTemplate contains two Button controls that use EventBubbling. When I click either of them I receive the following error: Server Error in '/' Application....
25
by: dennijr | last post by:
ok, shell always used to be easy for me, now its starting to get annoying cause i dont know wats wrong heres the simplist code possible: Private Sub IExplorer_Click() a = Shell("C:\Program...
4
by: robert | last post by:
On a server the binary (red hat) installed python2.4 and also a fresh compiled python2.5 spits "sem_post: Invalid argument". What is this and how can this solved? Robert ============== ...
8
by: Lambda | last post by:
When I call the standard strncpy function, I provide it a negative argument, such as: strncpy(s, ct, -1) I compile the code with gcc, when I run, it says "Segmentation fault". Do you think...
9
by: 200dogz | last post by:
Hi guys, I want to have a button which opens up a new window when pressed. <asp:Button ID="Button1" runat="server" Text="Open new window" /> ... Button1.Attributes.Add("OnClick",
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
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,...
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,...
1
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
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
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...
0
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 ...

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.