js动态添加object

var dwf = document.createElement('object');    
  dwf.setAttribute("classid","clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95");    
  dwf.setAttribute("width",640);    
  dwf.setAttribute("height",480);    
  dwf.setAttribute("id", "myobject"); 
  var param = document.createElement("param");    
  param.setAttribute("name","AutoStart");    
  param.setAttribute("value","1");    
  dwf.appendChild(param);    
  var param1 = document.createElement("param");    
param1.setAttribute("name","FileName");    
param1.setAttribute("value","<%=basePath %>/video/"+filename);    
dwf.appendChild(param1);  
document.getElementById("videoDiv").removeChild(document.getElementById("myobject")); 
document.getElementById("videoDiv").appendChild(dwf);

 

 

原文链接:http://www.oschina.net/question/1421895_218104

posted @ 2016-01-04 18:11  半前端半设计的四不像  阅读(1268)  评论(0)    收藏  举报