This JS code works great in Firefox, Opera, but not in Internet Explorer...

The problem is this line:
Code:
el_Label.appendChild(newtext);
I open a second window with a image selector by click, the selected images then are added to a form in the first windows.

<table class="hairline" style="font-size: 10px">
<tr>
<td><img onCLick="javascript:addMedia(this);" id="ID-NUMBER" src="IMAGE" alt="TEXT" width="90" /></td>
</tr>

<tr>
<td><img onCLick="javascript:addMedia(this);" id="ID-NUMBER" src="IMAGE" alt="TEXT" width="90" /></td>
</tr>
</table>


Code:
// Add media
function addMedia(obj)

{

	if (opener.document.getElementById('media-' + obj.id)) {

		alert('Media already exists.');

	} else {

		var el_main = opener.document.getElementById('media-container');

		// Create list element
		el_Media = opener.document.createElement('li');
		el_Media.id = 'media-' + obj.id;
		el_Media.className = 'thumbnail';
		//el_Media.onclick = function(){this.parentNode.parentNode.removeChild(this.parentNode);};

		// Create hidden input field
		el_INPUT = opener.document.createElement('input');
		el_INPUT.name = "media[]";
		el_INPUT.value = obj.id;
		el_INPUT.type = "hidden";

		// Add mediaThumb
		el_IMG = opener.document.createElement('div');
		el_IMG.id = 'mediaThumb-' + obj.id;
		el_IMG.className = 'mediaThumb';
		el_IMG.style.backgroundImage = "url('" + obj.src + "')";

		// Add remove button
		el_Label = opener.document.createElement('div');
		el_Label.id = 'mediaLabel-' + obj.id;
		el_Label.className = 'mediaLabel';
		el_Label.onclick = function(){this.parentNode.parentNode.removeChild(this.parentNode);};
		var newtext = document.createTextNode("Remove");

		// Add it to the document
		el_Media.appendChild(el_INPUT);
		el_Media.appendChild(el_IMG);
		el_Media.appendChild(el_Label);
		el_Label.appendChild(newtext);
		el_main.appendChild(el_Media);

		opener.initMedia();

	}
}

I know there are problems with IE and appendchild... please point me to a workaround even if adding an new external JS or someting.


Engel