User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the HTML and CSS section within the Web Development category of DaniWeb, a massive community of 425,928 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,689 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our HTML and CSS advertiser: Lunarpages Web Hosting
Views: 4046 | Replies: 2
Reply
Join Date: Aug 2005
Location: Carmel, IN
Posts: 67
Reputation: Sailor_Jerry is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 2
Sailor_Jerry's Avatar
Sailor_Jerry Sailor_Jerry is offline Offline
Junior Poster in Training

Help htmlfile: Invalid argument error using AppendChild

  #1  
Oct 23rd, 2006
I get this script error “Invalid argument” when using appendChild(). When in Microsoft Visual Studio Debugger I see “htmlfile: Invalid argument”, and the line it blows up on is t.appendChild(n);

The div I want to append the child div to is the top most div in the dom.
Anyone see what I am doing wrong here?

var t = document.parentWindow.parent.parent.document.getElementById("mod"); 
var n = document.createElement("div");
n.setAttribute("id", "c_dlg"); 
t.appendChild(n);

Thanks
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2006
Location: Utrecht, The Netherlands
Posts: 9
Reputation: BudBrocken is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
BudBrocken BudBrocken is offline Offline
Newbie Poster

Re: htmlfile: Invalid argument error using AppendChild

  #2  
Oct 25th, 2006
Could you post the corresponding HTML code?
Reply With Quote  
Join Date: Jul 2007
Posts: 1
Reputation: oxymeboy is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
oxymeboy oxymeboy is offline Offline
Newbie Poster

Solution Re: htmlfile: Invalid argument error using AppendChild

  #3  
Jul 26th, 2007
This is late reply to this post but it might help someone searching with this problem.

I found that creating the new element within the same document I needed to append to fixed a similar problem I was having.

So in this case creating the new div like this may be a fix for this problem:

  1. document.parentWindow.parent.parent.document.createElement("div");

Hope this helps someone.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb HTML and CSS Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the HTML and CSS Forum

All times are GMT -4. The time now is 9:05 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC