var wObject=document.createElement( "object ");
var wDiv=document.createElement( "div ");
//wObject.classid= "clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95 "; //mediaplayer
wObject.classid= "clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa "; //realplayer
wObject.width=560;
wObject.height=560;
wObject.AUTOSTART=-1;
wObject.SetSource( " ");
wObject.CONTROLS= "ImageWindow ";
wObject.SetEnableContextMenu(false);
wObject.ShowControls=false;
wObject.SetVolume(-600);
try
{
wDiv.appendChild(wObject);
}
catch(e)
{
alert(e.description + e.number);
}
document.write(wDiv.outerHTML);
这段js用mediaplayer正常用realplayer appendChild 时老报错为什么啊!!!请问其中的原因!!!
------解决方案--------------------
先append,然后再设置classid试试看.
try
{
wDiv.appendChild(wObject);
wObject.classid= "clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa ";
}
------解决方案--------------------
好像这样的object都必须在创建之前就加好属性
var wObject=document.createElement( " <object classid= "clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95 "> ");
------解决方案--------------------
很少这样写的,一般都是
document.write( ' <object id= "xxx "......> .... </object> ');