admin管理员组

文章数量:1399947

I am checking out this link :

The page is a slideshow where the user can either press the Next/Previous button or use the right/left arrow keys to navigate through the slideshow. Everytime the user does a navigation, the ad unit on the right sidebar does a refresh. Any idea how this can be effected?

I am checking out this link : http://www.businessinsider./the-worlds-weirdest-etfs-that-you-can-trade-today-2011-10#market-vectors-gaming-etf-nyse-bjk-1

The page is a slideshow where the user can either press the Next/Previous button or use the right/left arrow keys to navigate through the slideshow. Everytime the user does a navigation, the ad unit on the right sidebar does a refresh. Any idea how this can be effected?

Share Improve this question asked Oct 10, 2011 at 16:34 Anand SAnand S 191 gold badge1 silver badge2 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

The advertisement is displayed in an iframe (so it is not a simple div, in which case you would have to reload content using Ajax).

In the event handler for the navigation buttons, you simply have to reload this iframe.

You can either do this by using location.reload():

document.getElementById('myiframe').reload(true);
/*"true" means the URL should not be reloaded from cache*/

or setting the src to its current value:

var myIframe=document.getElementById('myiframe');
myIframe.src=myIframe.src;

本文标签: javascriptHow to trigger refresh of a div unit on a page (Example given)Stack Overflow