如何将 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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 08:05:44  来源:igfitidea点击:

How to embed a swf file into html code?

htmlflash

提问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

From w3school

来自 w3school

<object width="550" height="400">
   <param name="movie" value="somefilename.swf">
   <embed src="somefilename.swf" width="550" height="400">
   </embed>
</object>

More info here

更多信息在这里

回答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 的链接。这就是我发布此内容时正在寻找的内容。你应该改用它。它的开发和维护更加积极。