1

我在使用 AAPL for Wordpress 及其重新加载代码时遇到了一些问题。

http://wordpress.org/extend/plugins/advanced-ajax-page-loader/

我必须重新加载从 Flickr 小部件 URL 调用 Javascript 的 Flickr 小部件。它像 JS 一样调用这个 URL:

http://www.flickr.com/badge_code_v2.gne?count=9&display=random&&layout=x&source=user&user=(USERID)@N02&size=s

调用的 javascript 返回此标记:

var b_txt = '';

// write the badge



    b_txt+= '<div class="flickr_badge_image" id="flickr_badge_image1"><a href="http://www.flickr.com/photos/92475511@N02/8405790393/"><img src="http://farm9.staticflickr.com/8375/8405790393_ef9e7a4e55_s.jpg" alt="Una foto su Flickr" title="9° Palio delle Facoltà @ CUS Catania" height="75" width="75"></a></div>';


    b_txt+= '<div class="flickr_badge_image" id="flickr_badge_image2"><a href="http://www.flickr.com/photos/92475511@N02/8406884700/"><img src="http://farm9.staticflickr.com/8358/8406884700_812180d298_s.jpg" alt="Una foto su Flickr" title="Mercatini di Natale - Dicembre 2012" height="75" width="75"></a></div>';


    b_txt+= '<div class="flickr_badge_image" id="flickr_badge_image3"><a href="http://www.flickr.com/photos/92475511@N02/8406883634/"><img src="http://farm9.staticflickr.com/8370/8406883634_cdb4b75b27_s.jpg" alt="Una foto su Flickr" title="Sit in di protesta contro la Strage di Brindisi" height="75" width="75"></a></div>';


    b_txt+= '<div class="flickr_badge_image" id="flickr_badge_image4"><a href="http://www.flickr.com/photos/92475511@N02/8405790285/"><img src="http://farm9.staticflickr.com/8504/8405790285_4c6f762a9e_s.jpg" alt="Una foto su Flickr" title="9° Palio delle Facoltà @ CUS Catania" height="75" width="75"></a></div>';


    b_txt+= '<div class="flickr_badge_image" id="flickr_badge_image5"><a href="http://www.flickr.com/photos/92475511@N02/8406892022/"><img src="http://farm9.staticflickr.com/8213/8406892022_027ae8b541_s.jpg" alt="Una foto su Flickr" title="Samuela Schilirò @ Feltrinelli - Catania" height="75" width="75"></a></div>';


    b_txt+= '<div class="flickr_badge_image" id="flickr_badge_image6"><a href="http://www.flickr.com/photos/92475511@N02/8406884602/"><img src="http://farm9.staticflickr.com/8183/8406884602_8aa7d0046a_s.jpg" alt="Una foto su Flickr" title="Sit in di protesta contro la Strage di Brindisi" height="75" width="75"></a></div>';


    b_txt+= '<div class="flickr_badge_image" id="flickr_badge_image7"><a href="http://www.flickr.com/photos/92475511@N02/8405790967/"><img src="http://farm9.staticflickr.com/8237/8405790967_b2926b1218_s.jpg" alt="Una foto su Flickr" title="9° Palio delle Facoltà @ CUS Catania" height="75" width="75"></a></div>';


    b_txt+= '<div class="flickr_badge_image" id="flickr_badge_image8"><a href="http://www.flickr.com/photos/92475511@N02/8405791329/"><img src="http://farm9.staticflickr.com/8216/8405791329_398c6b0d4e_s.jpg" alt="Una foto su Flickr" title="Mercatini di Natale - Dicembre 2012" height="75" width="75"></a></div>';


    b_txt+= '<div class="flickr_badge_image" id="flickr_badge_image9"><a href="http://www.flickr.com/photos/92475511@N02/8406884314/"><img src="http://farm9.staticflickr.com/8497/8406884314_92e5c6dc61_s.jpg" alt="Una foto su Flickr" title="Sit in di protesta contro la Strage di Brindisi" height="75" width="75"></a></div>';


b_txt += '<span style="position:absolute;left:-999em;top:-999em;visibility:hidden" class="flickr_badge_beacon"><img src="http://geo.yahoo.com/p?s=792600102&t=6e94e5b35e270281f978527bf40fa8db&r=http%3A%2F%2Fcatania.liveuniversity.it%2F&fl_ev=0&lang=it&intl=uk" width="0" height="0" alt="" /></span>';

document.write(b_txt);

因此 Flickr JS 将标记直接写入 DOM。显然它需要由 AAPL 重新加载才能重新执行 document.write。

然后我必须重新加载一个与 Flickr 小部件具有相同行为的 JS 文件。我假设两者都必须以相同的方式重新加载:

    // Kirecom Networks
var images = [],
index = 0;

images[0] = "<a href = 'http://www.centrodidatticoathena.it/servizi' target='_blank'><img src='http://images.catania.liveuniversity.it/sites/3/athena/bannergenerale.jpg' width='262' alt='Athena'></a>";

images[1] = "<a href = 'http://www.centrodidatticoathena.it/corso-serale-di-inglese/' target='_blank'><img src='http://images.catania.liveuniversity.it/sites/3/athena/corsoinglese50.jpg' width='262' alt='Athena'></a>";

images[2] = "<a href = 'http://www.centrodidatticoathena.it/servizi/' target='_blank'><img src='http://images.catania.liveuniversity.it/sites/3/athena/tesi200.jpg' width='262' alt='Athena'></a>";

images[3] = "<a href = 'http://www.centrodidatticoathena.it/servizi/' target='_blank'><img src='http://images.catania.liveuniversity.it/sites/3/athena/lezionindividuali.jpg' width='262' alt='Athena'></a>";

images[4] = "<a href = 'http://www.centrodidatticoathena.it/servizi/' target='_blank'><img src='http://images.catania.liveuniversity.it/sites/3/athena/inglesespagnolo5.jpg' width='262' alt='Athena'></a>";

index = Math.floor(Math.random() * images.length);

document.write(images[index]);

//Stop randomizing

你能帮我重新加载代码吗?在我看来,我应该将 JS 文件重新写入 div,用他的 ID 选择它,或者刷新包含 javascripts 的 DIV(它们在页面的正文中),但我不知道该怎么做.

非常感谢!

4

0 回答 0