I tried your suggestion but it didn't make a difference. Now the error is: 'document.data.forms.elements' is null or not an object ... again, only in IE (6.0.28 version).
Original page is in:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
but even with a "degraded standard" it is not working:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
re: container and html
mypara is a div with id="it"
it's just <div id="it"></div>
the whole function is sitting in the html header between <script></script> tags...
the "post" method supposed to send data to a server which opens a new page in iframe id="iwindow"
IE just can't recognise the element to write into it... The forml works if I create a "submit button" and include some values with the getform() script but I can't write to it new values later on. Also, it works fine if I have a form wirtten in html...
OK, I have encountered this same problem just recently when doing some work for a client. The problem is that IE doesn't update its outerHTML property value for changes to the name attribute. In my case, I was cloning existing elements and having to increment the numeric suffix of the element names and, thus, I had to do a replace of the old name with the new name in the outerHTML property. In your case, you just need to add the name attribute to the outerHTML property. Here is what I came up with for you:
myinput = myform.appendChild(myinput);
myform = mydiv.appendChild(myform);
myinput.outerHTML = myinput.outerHTML.replace(/>/, " name="+myinput.name+">");
myform.outerHTML = myform.outerHTML.replace(/>/, " name="+myform.name+">");
I have pretty much the same code except that i already have a form created and i am pulling fields from an array that my server returned. I had it all working in Firefox, but stumbled upon the name problem with IE. I saw this post and i did the suggested and it works in IE now but not in FF. I get an error in FF that says "newInput.outerHTML has no properties". Do i need to put a condition in to only run the outerHTML code when the client browser is IE? Thanks!
var myDiv = document.getElementById("tab2")
var i = 0;
newBreak = document.createElement('br');
newBreak2 = document.createElement('br');
newLabel = document.createElement('label');
newLabelText = document.createTextNode(r.form_array[i]);
//CREATE FORM ELEMENT AND ASSIGN PROPERTIES
newInput = document.createElement('input');
newInput.setAttribute('className','textField'); //FOR HORRIBLE IE
newInput.setAttribute('class','textField'); //FOR WONDERFUL FIREFOX
newInput.setAttribute('onBlur',r.form_array[i]); //FOR WONDERFUL FIREFOX
//APPEND TO DOCUMENT
newInput = myDiv.appendChild(newInput);
newInput.outerHTML = newInput.outerHTML.replace(/>/, " name ="+newInput.name+">");
once you use outerHTML.replace to force element.name to be recognized, it will break the attachEvent functionality in IE. I am currently at an em passe because I cannot seem to use the outerHTML.replcace fix to allow me to getElementsByName AND attachEvent on the same element
If someone knows different, or knows how...please post here?