2011-06-06 62 views
1

有使用SWFObject的嵌入Flash使用SWFObject與嚴格的DOCTYPE

沒有嚴格的DOCTYPE聲明的DOCTYPE下嵌入閃存聊天室等於嚴格的一個問題,我失去了保證金:IE下自動使用。使用嚴格的Flash聊天室的文檔類型根本不會正確加載。我讀了嚴格的doctype的swfobject嵌入技術,但實際上無法得到它。這就是我在下面,但它在頂部一起squishes閃存而不是高度在100%擴展它

<!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" xml:lang="en" lang="en"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<title>Flashchat</title> 
<link href="sitecss.asp" rel="stylesheet" type="text/css" /> 
</head> 

<body> 
<div id="flash_swf"> 
<script type="text/javascript"> 
//<![CDATA[ 
var so = new SWFObject("swf.swf", "videochat", "100%", "100%", "8", "#FFFFFF"); 
so.addVariable("rootPath", "http://www.domain.com/flashchat/"); 
so.addVariable("roomId", "Room"); 
so.addVariable("app", "chat/videochat.swf"); 
so.addVariable("uid", "somename"); 
so.addVariable("skin", "Lead Grey"); 
so.addParam("wmode", "opaque"); 
so.write("flash_chat_swf"); 
// ]]> 
</script> 
</div> 

</body> 
</html> 

OK的,我用JavaScript來調整在頁面加載

<script type="text/javascript"> 
function resize(){ 
var frame = document.getElementById("flash_swf"); 
var htmlheight = document.body.parentNode.scrollHeight; 
var windowheight = window.innerHeight; 
if (htmlheight < windowheight) { document.body.style.height = windowheight + "px"; frame.style.height = windowheight + "px"; } 
else { document.body.style.height = htmlheight + "px"; frame.style.height = htmlheight + "px"; } 
} 
</script> 

<body onload="resize()" onresize="resize()"> 

閃光但是,我有一個頂部菜單,高度爲40px。所以我必須爲DIV邊距設置一個邊距:40px 0 0 0 ;.現在閃光燈被截斷40px太短。如何在javascript中設置htmlheight和windowheight,使其40像素(-40px)以下?

回答

1

我不認爲文檔類型與您的問題有任何關係! 你使用的是最後一個版本的SWFObject(我認爲你使用的嵌入方法是舊的...)?

反正線

so.write("flash_chat_swf"); 

so.write("flash_swf"); // corresponds to the div id the flash should be written in 

代替,請插入Java腳本代碼的股利之外。

而不是手動調整窗口大小,你應該實現這個腳本:http://swffit.millermedeiros.com/這對swfobject很好。

希望這會有所幫助!

相關問題