SWFObject基本用法实例分析
本文实例讲述了SWFObject基本用法。分享给大家供大家参考。具体分析如下:
SWFObject是一个用于在HTML中方面插入Adobe Flash媒体资源(*.swf文件)的独立、敏捷的JavaScript模块。该模块中的JavaScript脚本能够自动检测PC、Mac机器上各种 主流浏览器对Flash插件的支持情况。它使得插入Flash媒体资源尽量简捷、安全。而且它是非常符合搜索引擎优化的原则的。此外,它能够避免您的 HTML、XHTML中出现object、embed等非标准标签,从而符合更加标准。
基本使用:
<!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>
参数定义:
<script type="text/javascript"> var flashvars = { name1: "hello", name2: "world", name3: "foobar" }; var params = { menu: "false" }; var attributes = { id: "myDynamicContent", name: "myDynamicContent" }; swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0","expressInstall.swf", flashvars, params, attributes); </script>
参数定义2:
<script type="text/javascript"> var flashvars = false; var params = {}; var attributes = { id: "myDynamicContent", name: "myDynamicContent" }; swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0","expressInstall.swf", flashvars, params, attributes); </script>
希望本文所述对大家的javascript程序设计有所帮助。
相关推荐
baynkbtg 2019-12-03
careyourself 2017-08-18
仙游阁 2012-08-04
deerclops 2014-12-28
罗惠东 2014-04-30
别告诉我有Bug 2013-06-25
hong 2013-01-23
Tomhsfreestyle 2012-07-20
baihehua00 2012-06-13
每天积累一点点 2012-05-25
xiaohuli 2012-04-26
lxpandsq 2012-03-13
hhhkhhh 2012-02-01
lxpandsq 2011-12-05
MyIgnorance 2011-10-22
Raindan 2011-10-12
别告诉我有Bug 2011-09-22
zwq 2011-06-29
homesmile 2011-06-17