A simple question,
How to detect all <object>
tag in the dom and add <param name="wmode" value="transparent">
or change 开发者_如何学编程its 'wmode' to transparent using jquery.
Thanks in advance.
jQuery code like this will attempt to change the parameter.
$('object').each(function(index, elem) {
var wmode = elem.children('param[name="wmode"]');
if(!wmode.length) {
elem.append('<param name="wmode" value="transparent"/>');
} else {
wmode.attr('wmode', 'transparent');
}
});
However, this will not achieve the desired effect; you need to completely delete and recreate the object for the change to actually take effect. (I've tried, in the past, temporarily removing and then re-adding the object tag, without cross-browser success.) You may want to look at the SWFObject library. There's even a jQuery plugin for it.
精彩评论