开发者

jquery to change swf

I want to be able to change the swf file showing on a page using the code below (with the comment turned into real code)

Is this possible??

jquery:

$("div.360container > p").click( function() {
    // show di开发者_开发百科fferent swf by changing the value of the first param and src of the embed
});

html:

<div class="mycontainer" style='padding:2px;'>

  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="650" height="350">
    <param name="movie" value="/mySwf.swf" />
    <param name="quality" value="high" />
    <param name="wmode" value="opaque" />
    <embed src="/mySwf.swf" quality="high" wmode="opaque" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="650" height="350"></embed>
  </object>

  <p>click to change...</p>
</div>


Most reliable way to do that would be to set innerHTML of the element to your HTML. So, using jquery:

$("div.360container > p").click( function() {
    // show different swf by changing the value of the first param and src of the embed
    $(".mycontainer").html("<object ....><param name='movie' value='" + movieUrl + "' />....");
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜