Loading ...
Sorry, an error occurred while loading the content.

RE: [ydn-javascript] YAHOO.util.Element.replaceChild()?

Expand Messages
  • Charles
    Folks, This code replaces a tag with a containing a QuickTime Movie. It works in everything except IE. In IE, the Movie appears centered at the top-left
    Message 1 of 7 , Jan 30, 2007
    • 0 Attachment

      Folks,

       

      This code replaces a tag with a <div> containing a QuickTime Movie. It works in everything except IE. In IE, the Movie appears centered at the top-left corner of the window in IE.

       

             var oParentEl = oElement.parentNode;

             var oTempEl = document.createElement('div');

             oTempEl.innerHTML = html;

      oElement.parentNode.replaceChild(oTempEl, oElement);

       

      This seems like an obvious IE bug, and I’m having trouble with a workaround. My theory is that for IE I should split this into two steps, first inserting the <div> into the document, then the <div> contents after that.

       

             // replace original <object> _then_ insert content

             var oParentEl = oElement.parentNode;

             var oTempEl = document.createElement('div');

             oElement.parentNode.replaceChild(oTempEl, oElement);

             oTempEl.innerHTML = html;

       

      This code also works in everything but IE, where it gives me the “unknown runtime error” I mentioned below.

       

      FWIW, this is for a free tool that I hope will benefit thousands of people. Yes, I’m begging. J

       

      — Charles

       

      From: Charles [mailto:lists07@...]
      Sent: Tuesday, January 30, 2007 9:20 AM
      To: 'ydn-javascript@yahoogroups.com'
      Subject: RE: [ydn-javascript] YAHOO.util.Element.replaceChild()?

       

      Matt,

       

      I think this is part of tabview, right?

       

      var oNewElement = document.createElement('div');

                  YAHOO.util.Element.replaceChild(oNewElement, oElement);

       

      I’d really like to avoid adding another file just for this, but IE is returning "unknown runtime error" for this seemingly-simple operation that all other browsers seem to handle just fine:

       

      oContainerEl.innerHTML = html;

       

      oContainerEl is a <div>, and the html is an <object> (with a nested <element>) that embeds a QuickTime Movie (or Flash, or whatever).

       

      If you search for ie innerhtml "unknown runtime error", you’ll see that tons of people seem to have this problem with just IE, and there doesn’t seem to be a consistent solution.

       

      — Charles

       

    Your message has been successfully submitted and would be delivered to recipients shortly.