jQuery动态文件flashvar

时间:2012-11-08 13:22:45

标签: jquery flashvars

使用以下代码

var $altContent = $elem.children('img').attr('alt');

$('.fp_preview').prepend("<div id='video-flv'>  <object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab' width='720' height='480' id='flv'> <param name='movie' value='WNFlvPlayer.swf' /> <param name='allowfullscreen' value='true' /> <param name='flashvars' value='file='"+
$altContent+
"&autostart=true' /> <embed src='WNFlvPlayer.swf' flashvars='file='"+$altContent+"&autostart=true' allowfullscreen='true' width='720' height='480' name='flv' type='application/x-shockwave-flash' pluginspage='http://www.adobe.com/go/getflashplayer' /> </object> </div>").fadeIn(2000);

我明白了:

<param 04.flv&autostart="true'" animations="" arch="" renders="" 
value="file=" name="flashvars">

我认为是嵌套引号

2 个答案:

答案 0 :(得分:2)

试试这个

var $altContent = $elem.children('img').attr('alt');
alert($altContent);
$('.fp_preview').prepend(
'<div id="video-flv">'+
'  <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" width="720" height="480" id="flv">'+
'    <param name="movie" value="WNFlvPlayer.swf" />'+
'    <param name="allowfullscreen" value="true" />'+
'    <param name="flashvars" value="file='+$altContent+'&autostart=true" />'+
'    <embed src="WNFlvPlayer.swf" flashvars="file='+$altContent+'&autostart=true" allowfullscreen="true" width="720" height="480" name="flv" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />'+
'  </object>'+
'</div>'    
).fadeIn(2000);

答案 1 :(得分:1)

适用于&gt;

change value ='file ='“+ to value ='file =”+ -

<param name='flashvars' value='file="+$altContent+"&autostart=true' /> 

thannkss !!