<object id=x>
Mediaplayer
<param name=src value="**.avi"></object>document.all.x.src='new.avi'
or
document.all.x.FileName='new.avi'不同版本不同

解决方案 »

  1.   

    可能你在innerHTML中录入<object>Mediaplayer<param name=src value="**.avi"></object>时,没有将其中的双引号改为单引号。以后出现问题的时候一定要仔细看看报错信息,然后检查自己的代码。
    下面是一个详细的关于innerText & innerHTML的例子:<!-- innerHTML test . Author:chouchy Date:2003-10-17 10:30 GMT --><html>
    <head>
    <title>innerHTML test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <style>
    <!--
    body {font-family:"宋体";color="blue";font-size="9pt"}
    div {cursor: hand}
    -->
    </style>
    <script language="JavaScript">
    function changeText()
    {
    T1.innerText="我很好!";
    }//functionfunction changeHtml()
    {
    T2.innerHTML="<i><u><b><font color='#FF0000'>是的,我很想!</font></b></u></i>";
    }//functionfunction showplay()
    {
    Mydiv.innerHTML="<object id='WMPlay' width=392 height=300 classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2o99.cab#Version=5,1,52,701' standby='Loading Microsoft Media Player components...' type='application/x-oleobject'>"
                      +"<param name='FileName' value='ok.wmv'>"
                      +"<embed type='video/x-ms-asf-plugin' pluginspage='http://www.microsoft.com/netshow/download/player.htm'  src='ok.wmv' width=400 height=300>"
                      +"</embed></object>";

    }//functionfunction back()
    {
    T1.innerText="您好吗?";
    T2.innerText="您想学习DHTML吗? ";
    Mydiv.innerText="播放影片... ... ";
    }
    </script>
    <script language="JavaScript">
    <!--
    function MM_reloadPage(init) {  //reloads the window if Nav4 resized
      if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
        document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
      else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
    }
    MM_reloadPage(true);
    // -->
    </script>
    </head><body bgcolor="#FFFFFF" text="#000000">
    <div id="Mydiv" style="position:absolute; left:200px; top:45px; width:400px; height:300px; z-index:1" onclick="showplay()">播放影片... 
      ...</div>
    <p><font color="gray">请点击下边的文字……</font>
    <ul>
      <li id="T1" onclick="changeText()" style="cursor:hand">您好吗? </li>
      <li id="T2" onclick="changeHtml()" style="cursor:hand">您想学习DHTML吗?</li>
      <li id="T3" onclick="back()" style="cursor:hand">恢复原样! </li>  
    </ul> 
    </body>
    </html>
      

  2.   

    我以前也碰過這類問題,結論是用innerHTML不能真正「製造」一個element出來的
    你試試
    <div id=name></div>
    <script>
    function createElement(){
      name.innerHTML="<div id=a style='width:50;height:50'></div>"
      a.style.backgroud="red";}
    </script>
      

  3.   

    innerHTML:存取标记对象内的子标记和内容,不含标记对象本身。outerHTML:存取标记对象内的子标记和内容,包含标记对象本身。再检查检查吧!