Nicci: Internet Explorer hat Problem mit appendChild (?)

Beitrag lesen

Hallo zusammen,

derzeit bastle ich an einem kleinen JavaScript, welches das Vorhandensein eines Flash-Plugins prüft und entsprechend handelt. Die Ausgabe erfolgt über die Funkionen des DOM.

Im Firefox funktioniert das Skript auch wie gedacht, im Internet Explorer jedoch nicht...

Entscheidend ist folgender Codeschnipsel:

var objAnzeige = document.getElementById('flash');
      var objPosition = objAnzeige.firstChild;

var objFlash = document.createElement('object');
      var objParamASA = document.createElement('param');
      var objParamMovie = document.createElement('param');
      var objParamQuality = document.createElement('param');
      var objParamBgcolor = document.createElement('param');
      var objEmbed = document.createElement('embed');

objFlash.setAttribute('classid', 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000');
      objFlash.setAttribute('codebase', 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0');
      objFlash.setAttribute('width', '1024');
      objFlash.setAttribute('height', '768');
      objFlash.setAttribute('id', 'flash_v4');
      objFlash.setAttribute('align', 'middle');

objParamASA.setAttribute('allowScriptAccess', 'sameDomain');
      objParamMovie.setAttribute('movie', 'flash_v4.swf');
      objParamQuality.setAttribute('quality', 'high');
      objParamBgcolor.setAttribute('bgcolor', '#ffffff');

objEmbed.setAttribute('src', 'flash_v4.swf');
      objEmbed.setAttribute('quality', 'high');
      objEmbed.setAttribute('bgcolor', '#ffffff');
      objEmbed.setAttribute('width', '1024');
      objEmbed.setAttribute('height', '768');
      objEmbed.setAttribute('name', 'flash_v4');
      objEmbed.setAttribute('align', 'middle');
      objEmbed.setAttribute('allowScriptAccess', 'sameDomain');
      objEmbed.setAttribute('type', 'application/x-shockwave-flash');
      objEmbed.setAttribute('pluginspage', 'http://www.macromedia.com/go/getflashplayer');

objFlash.appendChild(objParamASA);
      objFlash.appendChild(objParamMovie);
      objFlash.appendChild(objParamQuality);
      objFlash.appendChild(objParamBgcolor);

objFlash.appendChild(objEmbed);

objAnzeige.insertBefore(objFlash, objPosition);

Der Internetexplorer zeigt hier nur eine leere Seite an und meldet zudem "Ungültiges Argument" für die Zeile, in der "objFlash.appendChild(objParamMovie);" steht. Kommentiere ich diese aus, kommt die selbe Fehlermeldung für die nächste Zeile, und so weiter.

Es sollte doch aber möglich sein, einem Objekt mehr als ein Child-Element zuzuweisen?

Ist jemand schlauer als ich?

Nicci