开发者

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

开发者 https://www.devze.com 2023-03-21 00:17 出处:网络
I use swfobject.js file to embed flash content onto my website. How does one add the html title attribute to the flash-object embed through it.

I use swfobject.js file to embed flash content onto my website. How does one add the html title attribute to the flash-object embed through it.

Since, some of the browsers do show the title of the object on mouseover or in status, as a too开发者_开发百科ltip or in browser status. [ Eg. IE6 and Opera ]

Please help

Anita


You can pass in variables to a Flash file, and enable the tooltip in a cross-platform way.

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

Get the value from DOM:

document.title

So:

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


Using 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号