Onsubmit fails in IE

I have created a simple form for uploading text files. You can see two versions of it at:

I am too new to post a link in this forum, but you can see examples of the form at wiseware dot com slash test.

The one created with static HTML works fine in current versions of major browsers. However, the one created with javascript, fails (only) in IE.

Can anyone help me understand what is going on here?


The <body> is there in the HTML. It includes the onload=“initialize();” that builds the page. I don’t think another <body> would be a good idea.


I did a recheck and saw that, and deleted my message since it had no useful information. Sorry for my mistake.

It turns out that a bug in IE precludes specifying the “name” attribute dynamically. The only workaround is this ugly business:

    var b = document.getElementsByTagName('body')[0];
    b.innerHTML = '&lt;div id="uploadDiv" style="width: 500px; padding: 5px; margin-bottom: 5px; border: 1px solid #3333FF;"&gt;'+
                  '&lt;form id="uploadForm" action="upload.php" method="post" enctype="multipart/form-data"&gt;'+
                  '&lt;input id="uploadInput" type="file" name="uploadFile"&gt;'+
                  '&lt;br /&gt;'+
                  '&lt;input type="submit" value="Submit"&gt;'+


If anyone knows of a less ugly solution, I would be glad to hear about it.

How lame of ie