这个例子由马特麦克唐纳:https ://stackoverflow.com/users/342129/matt-mcdonald
http://jsfiddle.net/meNVU/
*我的最终代码
外壳.css
body {background-color: #000000;}
div#ad
{
width: 728px;
height: 90px;
background-color: #000000;
margin-left: -365px;
margin-top: 77px;
position: absolute;
left: 50%;
z-index: 1;
}
shell.html(这需要我的 flash 对象被包裹在 javascript 中,以便使用 flash 调整大小,用于浏览器滚动条)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Charby The Vampirate</title>
<link rel="stylesheet"
type="text/css" href="shell.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script type="text/javascript">
var myQueryString=document.location.search;
if (myQueryString[0]='?')
{
myQueryString=myQueryString.substr(1, myQueryString.length-1);
}
var flashvars = {
dat: escape(myQueryString)
};
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1
if(is_chrome == true){
var params = {
allowFullScreen: "true",
menu: "false",
wmode: "transparent"
};
}else{
var params = {
allowFullScreen: "true",
menu: "false",
wmode: "window"
};
}
var attributes = {
id: "resized",
name: "resized",
wmode: "window"
};
swfobject.embedSWF("shell.swf", "resized", "100%", "100%", "10.0.0", "expressInstall.swf", flashvars, params, attributes);
</script>
<div id="ad">
<!-- Beginning of Project Wonderful ad code: -->
<!-- Ad box ID: 38564 -->
<script type="text/javascript">
<!--
var pw_d=document;
pw_d.projectwonderful_adbox_id = "43066";
pw_d.projectwonderful_adbox_type = "5";
//-->
</script>
<script type="text/javascript" src="http://www.projectwonderful.com/ad_display.js"></script>
<!-- Ending of Project Wonderful ad code: -->
</div>
</head>
<body>
<div id="resized" align="center"></div>
</body>
<script>
function ResizeFlash(newHeight){
$("#resized").css("height",newHeight);
}
</script>
</html>