今天我也遇到SWFObject在Firefox中设置大小为100%不显示的问题,在百度搜了一下,看到:http://hi.baidu.com/genedna/blog/item/6bdcb63ded689ac29e3d62e6.html 写道
SWFObject在Firefox中设置大小为100%不显示
现在开始用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:
目前我使用的Html(内含CSS),全文如下: 具体示例请浏览:
影忆坊的相关页面
现在开始用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 XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.registerObject("myFlashContent", "10.0.2", "expressInstall.swf");
</script>
<style type="text/css" media="screen">
<!--
html, body, #myFlashContentDiv {
height: 100%;
width: 100%;
overflow: hidden;
}
body {
margin:0;
padding:0;
}
-->
</style>
</head>
<body>
<div id="myFlashContentDiv">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%" id="myFlashContent">
<param name="movie" value="index.swf" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="index.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="点击获取最新版FlashPlayer" /> </a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
</body>
</html>