2010-12-14 28 views
0

我希望能夠使用下面的代碼更改顯示在頁面上的swf文件(評論變成真實代碼)jquery更改swf

這是可能嗎?

的jQuery:

$("div.360container > p").click(function() { 
    // show different 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> 

回答

1

最可靠的方法做到這一點是設置元素到你的HTML的innerHTML的。所以,使用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 + "' />...."); 
});