Home > Web Front-end > JS Tutorial > body text

SWFObject basic usage example analysis_javascript skills

PHP中文网
Release: 2016-05-16 15:49:34
Original
1408 people have browsed it

This article mainly introduces the basic usage of SWFObject. It analyzes the related skills of SWFObject in operating Flash files with examples. It has certain reference value. Friends in need can refer to it.

The examples in this article describe the basic usage of SWFObject. Share it with everyone for your reference. The specific analysis is as follows:

SWFObject is an independent and agile JavaScript module used to insert Adobe Flash media resources (*.swf files) into HTML. The JavaScript script in this module can automatically detect the support of Flash plug-ins by various mainstream browsers on PC and Mac machines. It makes inserting Flash media resources as simple and safe as possible. And it is very consistent with the principles of search engine optimization. In addition, it can avoid non-standard tags such as object and embed appearing in your HTML and XHTML, thereby complying with more standards.

Basic usage:

<!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>
  <p id="myContent">
   <p>Alternative content</p>
  </p>
 </body>
</html>
Copy after login

Parameter definition:

<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>
Copy after login

Parameter definition 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>
Copy after login

The above is the basic usage example analysis of SWFObject_javascript skills. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!