1

全部:我在 HTML 中创建了一个 DIV,并在 DIV 中嵌入了一个 Flash。下面是HTML:

<head>
...
<script src="Scripts/swfobject_modified.js" type="text/javascript"> </script>
<script src="Scripts/GHAnimateObjectMove.js" type="text/javascript"> </script>
<style type="text/css">
.GHLogoAniFlashDiv {
    margin: auto auto auto auto;
    height: 302px;
    width: auto;
    left: 0px;
    top: 0px;
    overflow:hidden;
}
.FlashID {
    margin: auto auto auto auto;
    height: 302px;
    width: 402px;
    left: auto;
    top: auto;
    overflow:hidden;
}  
</style>
</head>

<body>
<!-- align="center" align="absmiddle" align="center"  -->
<div id="GHLogoAniFlashDiv" > 
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="402" height="302"     class="FlashID" id="FlashID" title="GHLogoAniFlash">
<param name="movie" value="Animate/GHLogoAniFlash.swf" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<param name="swfversion" value="6.0.65.0" />
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<param name="SCALE" value="noscale" />
<embed src="Animate/GHLogoAniFlash.swf" quality="high" 
    width="402" height="302" name="movie"  
    play="true"
    loop="ture"
    quality="high"
    allowScriptAccess="sameDomain"
    type="application/x-shockwave-flash"
    pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
<!-- No IE -->
<!--[if !IE]> align="absmiddle"-->
<object data="Animate/GHLogoAniFlash.swf" type="application/x-shockwave-flash" width="402" height="302" >
 <!--[end if]-->
  <param name="quality" value="high" />
  <param name="wmode" value="transparent" />
  <param name="swfversion" value="6.0.65.0" />
  <param name="expressinstall" value="Scripts/expressInstall.swf" />
  <param name="SCALE" value="noscale" />
  <!-- Version of Flash Player <6.0 -->
  <div>
    <h4>Need Latest Adobe Flash Player。&lt;/h4>
    <p><a href="http://www.adobe.com/go/getflashplayer"><img  src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" width="112" height="33" /></a></p>
  </div>
  <!--[if !IE]>-->
  </object>
  <!--<![end if]-->
  </object>
  </div>
  ...

然后我在“GHAnimateObjectMove.js”中使用 javascript 将 flash 移动到浏览器的一个位置:

function SetGHLogoDivLocation()//Set Logo DIV location;
{
        var leftoffset=0;
    var rightoffset=0;
    LogoDivObj=document.getElementById("GHLogoAniFlashDiv");
    FlashObj=document.getElementById("FlashID");    
    try{
        findDimensions();
        leftoffset=parseInt(600);
        rightoffset=parseInt(300);
        LogoDivObj.style.postion="relative";
        if(LogoDivObj && FlashObj)
        {
            LogoDivObj.style.left=leftoffset+"px";
            LogoDivObj.style.top=rightoffset+"px";
            FlashObj.style.left=LogoDivObj.style.left;
            FlashObj.style.top=LogoDivObj.style.top;
        }
    }
    catch(err){
        window.alert(err.message);
    }
} 
...
window.onresize=function (){SetGHLogoDivLocation();};
window.onload=function () {SetGHLogoDivLocation()};

但它似乎无法将 flash 移动到新位置(600px,300px)。它仍然停留在页面的左侧。为什么?有人知道吗?我在 IE 9 win7 上测试。我在eclipse中调试。我看到 LogoDivObj.style.left 、LogoDivObj.style.top、FlashObj.style.left 和 FlashObj.style.top 已经改变了。但是为什么 flash 不能移动到新的位置呢?

4

0 回答 0