开发者

Replacing content with jquery

I am loading a movie into a overlay. My problem is that when I close the div overlay the movie continues to play. I do not control the code on the move side it is imported via a script tag which then opens in a iframe. I am able to remove the content of the of the div and then the movie stops playing. Then of course when the user opens the div again the movie is gone. My current thinking was that I could simply replace the script tag with one just like it but the outcome of that is that there is nothing there. I have been using jquery.

Thanks

-- script --

$(document).ready(function() {
    $("#closeModal2").click(function() {
        $("#movieContainer").html("<script src='http://www.accelacast.com/programs/launch.js'/>");
    });
});

-- html --

<div id="movieContainer">
    <script id="movieTag" language='JavaScript' src='http://www.accelacast.com/programs/launch.js'/>
</div>

On a side note. I tried replacing the src attribute of the script tag with no luck. I was 开发者_运维百科able to replace the src of a image though. Is it not possible to effect the src attribute of script?

Thanks


Try using $.getScript, it asynchronously loads & runs a javascript file. more info @ http://api.jquery.com/jQuery.getScript/ or jQuery append Google Adsense to div has some good info.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜