[转]利用iframe遮挡FLASH的方法

http://www.crazyfrom.com/basics/flash-jiaocheng/zhedang-flash.html

有一个FLASH必须将wmod设置为window模式,否则无法与页面通信,这个时候普通的将FLASH的wmod设置为透明的做法将无效,只能采取在要覆盖层里加一个空iframe并将iframe设置为absolute,z-index设置为-1,这样就利用iframe的优先级高于flash的特性遮挡住了下面的flash:

<html>
     <head>
       <title>div cover flash with iframe</title>
     </head>
     <body>
       <div id="cover_div" style="position:absolute;width:100px;height:100px;background-color:blue;z-index:9">I cover the Flash.</div>
       <div>
         <iframe id="cover_iframe" frameborder="0" style="position:absolute;width:100px;height:100px;z-index:8;"></iframe>
     <object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'
          codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0'
          width='400px' height='340px'>
       <param name='movie' value='http://blog.ku6.com/ku6_v.swf?id=38752_1011788' />
       <param name='quality' value='high' />
       <embed src='http://blog.ku6.com/ku6_v.swf?id=38752_1011788' quality='high'
            pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'
            type='application/x-shockwave-flash' width='400' height='340'>
           </embed>
     </object>
       </div>
     </body>
   </html>

但是在Firefox下发现不起作用,搜索到一个方法,原来在firefox下只需要给FLASH的容器设置为overflow:auto;即可,记录之:


<html>
     <head>
       <title>div cover flash with iframe</title>
     </head>
     <body>
       <div id="cover_div" style="position:absolute;width:100px;height:100px;background-color:blue;z-index:9">I cover the Flash.</div>
       <div style="overflow:auto;">
         <iframe id="cover_iframe" frameborder="0" style="position:absolute;width:100px;height:100px;z-index:8;"></iframe>
     <object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'
          codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0'
          width='400px' height='340px'>
       <param name='movie' value='http://blog.ku6.com/ku6_v.swf?id=38752_1011788' />
       <param name='quality' value='high' />
       <embed src='http://blog.ku6.com/ku6_v.swf?id=38752_1011788' quality='high'
            pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'
            type='application/x-shockwave-flash' width='400' height='340'>
           </embed>
     </object>
       </div>
     </body>
   </html>

你可能感兴趣的:(html,Flash,firefox)