最近用JS插入FLASH 用appendChild实现的 
唯独在IE下不行  把插入的代码单独放入HTML却可以  不知道IE是怎么解析的 一直是处于刷新状态<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
    function addEle(obj)
    {
        var swfname = obj.id;
        var swfpath = swfname;      //flash路径
                 var newObj = document.createElement("object");
            newObj.type = "application/x-shockwave-flash";
            newObj.data = swfpath;
            newObj.width = "300px";
            newObj.height = "250px";
            document.body.appendChild(newObj);
        
        var param1 = document.createElement("param");
        param1.name = "movie";
        param1.value = swfpath;
        newObj.appendChild(param1);    }
</script>
</head>
<body><input type="submit" name="button" id="http://d.lanrentuku.com/down/lanren/flashad/300x250-0321.swf" value="提交1" onclick="addEle(this);"/>
<input type="submit" name="button" id="http://d.lanrentuku.com/down/lanren/flashad/300x250-0322.swf" value="提交2" onclick="addEle(this);" /></body>
</html>

解决方案 »

  1.   

    var swfname = obj.id;
    var swfpath = swfname;      //flash路径
    var newObj = document.createElement("embed");
    newObj.type = "application/x-shockwave-flash";
    newObj.src = swfpath;
    newObj.width = "300px";
    newObj.height = "250px";document.body.appendChild(newObj);
      

  2.   

    http://www.02chan.com/blog/archives/183http://www.cnblogs.com/wuxinxi007/archive/2009/10/27/1590709.html下面这个更好。
      

  3.   

    最好用现成的包
    http://code.google.com/p/swfobject/
      

  4.   

    我也知道网上有现成的包  我只是想知道 我写的为什么不行 
    换成embed为什么可以了
      

  5.   


    上面的你没有设置src路径吧
    newObj.src = swfpath;