PDA

View Full Version : IE DOM problems...?



???
12-31-2008, 05:41 PM
First, this only applies to IE, because IE is the only browser I can't get something to work in. So I want to dynamically create this Flash element right?


window.onload = function () {
var fe = document.createElement ("object");
fe.setAttribute ("type","application/x-shockwave-flash");
fe.style.width = "100px";
fe.style.height = "100px";
var me = document.createElement ("param");
me.setAttribute ("name","movie");
me.setAttribute ("value","test.swf");
fe.appendChild (me);
document.body.appendChild (fe);
};

I get this 100 x 100 Flash element with nothing in it and when I right click it says "Movie not loaded...". Then I find what IE says "fe.outerHTML" is (I know it's bad, but it's only to see what IE thinks). Then I put that in the page.


<OBJECT style="WIDTH: 100px; HEIGHT: 100px" type=application/x-shockwave-flash><PARAM NAME="movie" VALUE="test.swf"><PARAM NAME="_cx" VALUE="5080"><PARAM NAME="_cy" VALUE="5080"><PARAM NAME="FlashVars" VALUE=""><PARAM NAME="Src" VALUE=""><PARAM NAME="WMode" VALUE="Window"><PARAM NAME="Play" VALUE="-1"><PARAM NAME="Loop" VALUE="-1"><PARAM NAME="Quality" VALUE="High"><PARAM NAME="SAlign" VALUE=""><PARAM NAME="Menu" VALUE="-1"><PARAM NAME="Base" VALUE=""><PARAM NAME="AllowScriptAccess" VALUE=""><PARAM NAME="Scale" VALUE="ShowAll"><PARAM NAME="DeviceFont" VALUE="0"><PARAM NAME="EmbedMovie" VALUE="0"><PARAM NAME="BGColor" VALUE=""><PARAM NAME="SWRemote" VALUE=""><PARAM NAME="MovieData" VALUE=""><PARAM NAME="SeamlessTabbing" VALUE="1"><PARAM NAME="Profile" VALUE="0"><PARAM NAME="ProfileAddress" VALUE=""><PARAM NAME="ProfilePort" VALUE="0"><PARAM NAME="AllowNetworking" VALUE="all"><PARAM NAME="AllowFullScreen" VALUE="false"></OBJECT>

Now that works. Why doesn't the first one work? It does in FF (except for FF it has to be "data" rather than "movie").

Thanks,
Stephen

???
01-01-2009, 06:02 PM
Help? Please? Well I found something else out that's really weird. If I add


document.body.innerHTML += fe.outerHTML;

to the end of the other, then two of the Flash elements appear that have loaded. I take it away, the one that hasn't loaded. I put it back, two loaded again. Can anyone explain this? Please?

jscheuer1
01-01-2009, 06:19 PM
I have no clue why this is happening to begin with. However, if what you've been saying is true, this may take care of the problem, replace:


document.body.innerHTML += fe.outerHTML;

with:


/*@cc_on @*/
/*@if(@_jscript_version >= 5)
fe.outerHTML = fe.outerHTML;
@end @*/

???
01-01-2009, 06:23 PM
What's all the other stuff about?


/*@cc_on @*/
/*@if(@_jscript_version >= 5)
fe.outerHTML = fe.outerHTML;
@end @*/

But thanks! Just fe.outerHTML = fe.outerHTML works, do I need the rest?
This is just another reason that IE is crazy...

Thanks again,
Stephen

jscheuer1
01-01-2009, 07:14 PM
That other code is proprietary IE conditional code. Whatever is inside of it will only be parsed by IE. All others see it as a javascript comment.