
Creating an object in script
Hi all!
The following code works great in Netscape 6 PR2, but I need to get it
to work in IE 5.0 +. (I tried in IE 5.5) At the moment, it produces a
Runtime error: Unexepected call to method or property access at the
appendChild methods on the elements I created in
JavaScript:(objectnode.appendChild(childnodeparam1); and
objectnode.appendChild(childnodeparam2);). I tried in jscript and VBScript.
I need a solution fast. Can anyone please help me, please?
<HTML>
<HEAD>
<SCRIPT >
function playFlash()
{
objectnode = document.createElement("object");
objectnode.setAttribute("classid","clsid:D27CDB6E-AE6D-11cf-96B8-44455354000
0");
objectnode.setAttribute("codebase"," http://www.*-*-*.com/ #version=4,0,0,0");
objectnode.setAttribute("width", "400");
objectnode.setAttribute("height", "100");
objectnode.setAttribute("id", "myObject ");
childnodeparam1 = document.createElement("param");
childnodeparam1.setAttribute("name", "movie2");
childnodeparam1.setAttribute("value", "index.swf");
childnodeparam2 = document.createElement("param");
childnodeparam2.setAttribute("name", "bgcolor");
childnodeparam2.setAttribute("value", "#FFFFFF");
objectnode.appendChild(childnodeparam1);
objectnode.appendChild(childnodeparam2);
embedobject=document.createElement("embed");
embedobject.setAttribute("src","index.swf");
embedobject.setAttribute("swLiveConnect","FALSE");
embedobject.setAttribute("WIDTH","100%");
embedobject.setAttribute("HEIGHT","100%");
embedobject.setAttribute("QUALITY","high");
embedobject.setAttribute("BGCOLOR","#FFCC00");
embedobject.setAttribute("TYPE","application/x-shockwave-flash");
embedobject.setAttribute("PLUGINSPAGE"," http://www.*-*-*.com/
download/index.cgi?P1_Prod_Version=ShockwaveFlas");
objectnode.appendChild(embedobject);
document.getElementById('test').appendChild(objectnode);
Quote:
}
</SCRIPT>
</head>
<BODY onload="playFlash();">
<div id="test"
style="position:absolute;top:0px;left:0px;width:500px;height:500px">
</div>
</BODY>
</HTML>
Michelle Carrier