Click here to Skip to main content
15,899,313 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I now use this code below for changing the ads but it is reloading the entire page. I just want to reload the ads and not the entire page.
<meta http-equiv="refresh" content="3"/>


What is a better way to do this without the page refreshing completely?
Posted
Updated 20-Sep-10 22:34pm
v2

Simply use the javascript timer to handle it, like this:
JavaScript
function NewImage()
{
    document.images.clock.src = "clock.php";
    setTimeout('NewImage()',60000);
}
setTimeout('NewImage()',50);


The above code simply loads the same image over and over every minute so you have to supply some additional code to handle it properly.

A javascript ad rotator example:
http://www.abiglime.com/webmaster/articles/jscript/021298.htm[^]

Another way would be to add an iframe and let it refresh as you did with the complete page. You can google it for some examples.

Good luck!
 
Share this answer
 
v3
Hi, Please always mention which language/tech/platform you are using for your application, so that you can get the right answers quickly. I don't know what's yours?

I'm a .NET programmer, so you can use Adrotator component in ASP.NET. Others are following

ASP AdRotator Component[^]

ASP.NET AdRotator Control[^]

PHP Ad Rotator[^]

Java Banner Ad Rotator Applet[^]

JavaScript Banner Ad Rotator Script[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900