首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Flash >

解决Flash swf嵌入不能100%高度的有关问题

2012-10-10 
解决Flash swf嵌入不能100%高度的问题除了去掉html中w3c相关的代码,还可以用样式来解决,在网上查找到文章

解决Flash swf嵌入不能100%高度的问题
除了去掉html中w3c相关的代码,还可以用样式来解决,在网上查找到文章如下:

------------分割-----------

因为使用方便,所以开始用SWFObject的js包来显示SWF,但是当SWF的大小设置成为100%后,在Firefox中不显示。

查了一下,原因如下:

It was because I was trying to set the flash files height to 100%. But its parent (div id=wrapper) didn't have a height. And 100% of zero = zero. To fix this, i had to set the wrapper div, the body, and the html's height to 100%.

就是说包含SWF的DIV的Parent DIV的大小没有设置,高度按照0乘以100%来计算,所以高度为0在Firefox中自然就不可见了。
官方的建议是设置一下CSS:

<style type="text/css" media="screen">           html, body, #containerA, #containerB { height:100%; }          body { margin:0; padding:0; overflow:hidden; }</style>

本次项目登陆页详细代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>登录</title><script src="Scripts/swfobject_modified.js" type="text/javascript"></script><style type="text/css" media="screen"><!--html, body, #myFlashContentDiv {height: 100%;width: 100%;overflow: hidden;}body {margin:0;padding:0;}--></style></head><body bgcolor="#001a00"><div id="myFlashContentDiv">      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%" id="myFlashContent">      <param name="movie" value="http://static.ikaku.com/swf/login.swf" />      <!--[if !IE]>-->      <object type="application/x-shockwave-flash" data="http://static.ikaku.com/swf/login.swf" width="100%" height="100%">        <!--<![endif]-->        <a href="http://www.adobe.com/go/getflashplayer"> <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="解决Flash swf嵌入不能100%高度的有关问题" /> </a>        <!--[if !IE]>-->      </object>      <!--<![endif]-->    </object></div><script type="text/javascript">swfobject.registerObject("FlashID");</script></body></html>

热点排行