如何将 swf 文件嵌入到 html 代码中?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5705981/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to embed a swf file into html code?
提问by Alex Moreno
I need to embed a swf file into html code. How can I do it?
我需要将 swf 文件嵌入到 html 代码中。我该怎么做?
回答by Brad
Use SWFObject:
使用 SWF 对象:
http://code.google.com/p/swfobject/wiki/documentation
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>
回答by denislexic
回答by Noufal Ibrahim
You should try using flashobject. It's a Javascript utility that will detect whether the plugin is installed in a cross browser way and replace a given div with the flash object you want.
您应该尝试使用flashobject。这是一个 Javascript 实用程序,它将检测插件是否以跨浏览器的方式安装,并用您想要的 Flash 对象替换给定的 div。
Update. I see someone else has posted a link to SWFObject. That's what I was looking for when I posted this. You should use that instead. It's more actively developed and maintained.
更新。我看到其他人发布了一个指向 SWFObject 的链接。这就是我发布此内容时正在寻找的内容。你应该改用它。它的开发和维护更加积极。