1、object和embed标签
<div style="padding-left: 10px;">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave
/cabs/flash/swflash.cab#version=7,0,0,0"
width="650" height="350" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="system/writingBoard.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="flashvars" value='&id=${twoKey.key.questionId}&
userId=1&sdata=&tdata=&action=1&height=300'/>
<embed src="system/writingBoard.swf" quality="high"
bgcolor="#ffffff" width="650" height="350" name="mymovie"
flashvars='&id=${twoKey.key.questionId}&userId=1&sdata=&
tdata=&action=1&height=300'
align="middle" allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
这种方法是使用 object 和 embed 标签来嵌入,其中“D27CDB6E-AE6D-11CF-96B8-444553540000”是类ShockwaveFlash的GUID,定义一个id为Mp3Player的类实例。object 的很多参数和 embed 里面的很多属性是重复的,这是为了浏览器的兼容性,有的浏览器支持 object,有的支持 embed,这也是为什么要修改 Flash 的参数时两个地方都要改的原因。
缺点就是:embed 标签是 Netscape 的私有标签,虽然 embed 标签应用广泛存在,但是从HTML3.2,HTML4.0到XHTML1.0,W3C都没有收录这个标签。因此使用embed 标签的页面将不能通过W3C校验。另一方面,虽然只使用object标签可以通过验证,但是在盗版泛滥的中国,多数用户仍然在使用windows xp系统上自带的IE6浏览器,而它是不支持object标签的。
2、使用js嵌入,如SWFObject
var swfVersionStr = "9.0.0";
var _sdata = encodeURIComponent("");
var _tdata = encodeURIComponent("");
var xiSwfUrlStr = "flash/expressInstall.swf";
var flashvars =
{id:"${id}",userId:"1",sdata:_sdata,tdata:_tdata,action:"1",height:"300"};
var params = {};
params.quality = "high";
params.bgcolor = "#ffffff";
params.allowscriptaccess = "sameDomain";
params.allowfullscreen = "true";
var attributes = {};
attributes.id = "writingBoard";
attributes.name = "writingBoard";
attributes.align = "left";
swfobject.embedSWF(
"system/writingBoard.swf", "flashContent",
"750", "350",
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes);
<div id="flashContent">
<h1>
Alternative content
</h1>
<p>
<a href="http://www.adobe.com/go/getflashplayer"><img
src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
alt="Get Adobe Flash player" /> </a>
</p>
</div>