Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsWindows VistaWindows XPWindows MeWindows 98Windows 95Virtual PCInternet ExplorerOutlook ExpressWindows MediaSecurity
Related Topics
MS Server ProductsMS OfficePC HardwareMore Topics ...

Windows Forum / Internet Explorer / General Topics / June 2007

Tip: Looking for answers? Try searching our database.

Error in appendChild() (JavaScript, IE7)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
HoffLa - 30 Jun 2007 11:40 GMT
In some cases appendChild() changes the reference to the parent object to
reference the object returned by appendChild().

Example:
var form = document.forms['form1'];
var input = document.createElement('<INPUT name="input1">');
input.type = 'HIDDEN';
input.id = 'id1';
form.appendChild(input);

Sometimes the form variable at this point references the appended INPUT
object. I havn't figured out when this happens, the same code works as
expected in most cases.
I have observed this in IE7.0.5730.11, not in IE6 or FireFox.
HoffLa - 30 Jun 2007 12:06 GMT
Update:
I jumped to conclusions! The problem I had was when I did the following:

var form = document.forms['form1'];
var input = document.createElement('<INPUT name="submit">');
input.type = 'HIDDEN';
input.id = 'id1';
form.appendChild(input);
form.submit(); // IE7 tries to call the INPUT object named submit, which of
course gives an error message.

It is NOT a bug in appendChild(), although the behaviour is new in IE7.

BR
- L
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.