简体   繁体   English

swfobject:如何将 html 标题属性添加到 object(闪存)

[英]swfobject : how to add html title attribute to object (flash)

I use swfobject.js file to embed flash content onto my website.我使用 swfobject.js 文件将 flash 内容嵌入到我的网站上。 How does one add the html title attribute to the flash-object embed through it.如何将 html 标题属性添加到通过它嵌入的闪存对象中。

Since, some of the browsers do show the title of the object on mouseover or in status, as a tooltip or in browser status.因为,一些浏览器确实在鼠标悬停或状态、工具提示或浏览器状态中显示 object 的标题。 [ Eg. [例如。 IE6 and Opera ] IE6 和 Opera ]

Please help请帮忙

Anita安妮塔

You can pass in variables to a Flash file, and enable the tooltip in a cross-platform way.您可以将变量传递给 Flash 文件,并以跨平台的方式启用工具提示。

so.addVariable("var", "value"); 

Get the value from DOM:从 DOM 中获取值:

document.title

So:所以:

var mytitle;
var = document.title;
so.addVariable("mytitle", mytitle); 

Using SWFObject 2.2使用SWFObject 2.2

var attributes = {
   title: document.title
};
swfobject.embedSWF("mymovie.swf", //URL for SWF file
                   "mytargetdiv", //Target element
                   "550",         //SWF width
                   "400",         //SWF height
                   "9",           //Minimum required version of Flash Player
                   false,         //Path to ExpressInstall SWF (if desired)
                   false,         //Flashvars (if desired)
                   false,         //Parameters (if desired)
                   attributes);   //Attributes (if desired)

This assumes your <title> element is placed before your <script> element in your page's markup.这假定您的<title>元素位于页面标记中的<script>元素之前。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM