【发布时间】:2011-08-08 00:55:11
【问题描述】:
我需要在 html 代码中嵌入一个 swf 文件。我该怎么做?
【问题讨论】:
-
这个网站不适合问这类问题。请查看我们的常见问题解答。 stackoveflow.com/faq
我需要在 html 代码中嵌入一个 swf 文件。我该怎么做?
【问题讨论】:
来自 w3school
<object width="550" height="400">
<param name="movie" value="somefilename.swf">
<embed src="somefilename.swf" width="550" height="400">
</embed>
</object>
更多信息here
【讨论】:
您应该尝试使用flashobject。它是一个 Javascript 实用程序,它将检测插件是否以跨浏览器的方式安装,并将给定的 div 替换为您想要的 flash 对象。
更新。我看到其他人发布了指向 SWFObject 的链接。这就是我发布此内容时所寻找的。您应该改用它。它更积极地开发和维护。
【讨论】:
使用 SWFObject:
http://code.google.com/p/swfobject/wiki/documentation
<!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>SWFObject dynamic embed - step 3</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0");
</script>
</head>
<body>
<div id="myContent">
<p>Alternative content</p>
</div>
</body>
</html>
【讨论】: