I'm clicking on a link within an iframe and loading an html file into a div in the parent window, using jquery. This does load the content into the div in the parent window (I'm using top.document to refer to it), but part of that html file is loading swfobject with a new variable, to play a different swf. It works fine all on one page, but if I call it from the iframe, it doesn't reload SWFObject, but does load the rest of the html file... I'm baffled.
A:
Sure: html code in parent window:
<div id="filmblock">
content gets loaded inside this div
</div>
<div style="float:right">
<iframe src="onlinefilms.html" style="border:1px #deebf7 none; margin-bottom:28px;" name="onlineFilms" scrolling="yes" frameborder="1" marginheight="10px" marginwidth="10px" height="420px" width="360px"></iframe>
iframe code:
<script src="../../global/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
function loadContent(elementSelector, sourceURL) {
$(""+elementSelector+"", top.document).load("load_desc/"+sourceURL+"");
}
link:
<a href="javascript:loadContent('#filmblock', 'adjustyourcolor.html');"><img src="../images/thumbs/72x72/adjustyourcolor_trailer_th.jpg" alt="" width="50" height="50" border="0"></a>
Code for html file that gets loaded:
<div id="flashcontent" align="center">
You must have flash 9 or above to view video.
</div>
var fo = new Custom_SWFObject("basic_player_frame_autoplay.swf", "filmstrip", "338", "301", "8", "#ffffff");
fo.addVariable("chosen", "adjustyourcolor_trailer");
fo.write("flashcontent");
(the Custom SWFObject and fo. variables are from a custom version that I'm required to use on the server I work on, it works identically to swfObject and I use it all the time.
If I remove the top.document from the div loading function and keep the div on the same page as the iframe content, it loads the flash movie as expected. When I call it from the iframe to load the div into the parent window, it loads the rest of the content, but doesn't load the flash movie.
Thanks! Wendy
Wendy
2009-11-10 18:37:18