0

使用以下代码

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">

我认为是关于嵌套引号的。

4

2 回答 2

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);
于 2012-11-08T13:35:30.823 回答
1

它适用于 >

将 value='file='"+ 更改为 value='file="+ –

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

谢谢!!

于 2012-11-08T13:39:47.023 回答