Have seen Some banner ads which are rotating on a time base and if you also want to put that types of code i will tell you that it is very easy. You just have to add a simple script and your banner will start rotating.
Just put the below code where you want to add that banner rotation.
<script type="text/javascript">
var imgs1 = new Array("http://www.hosting_site.com/your_1st_image.gif","http://www.hosting_site.com/your_2nd_image.gif");
var lnks1 = new Array("http://istlink.com","http://www.2ndlink.com");
var alt1 = new Array();
var currentAd1 = 0;
var imgCt1 = 2;
function cycle1() {
if (currentAd1 == imgCt1) {
currentAd1 = 0;
}
var banner1 = document.getElementById('adBanner1');
var link1 = document.getElementById('adLink1');
banner1.src=imgs1[currentAd1]
banner1.alt=alt1[currentAd1]
document.getElementById('adLink1').href=lnks1[currentAd1]
currentAd1++;
}
window.setInterval("cycle1()",5000);
</script>
<a id="adLink1" http://istlink.com/="" href="" target="_top">
<img id="adBanner1" border="0" width="120" src="http://www.hosting_site.com/your_1st_image.gif" height="600"/></a>
When you will put above code your banner will rotate between 2 links. This is for only 2 links and 2 banners.
Note:-
1.Change link in green according to your self.
2.Change Width and height according to your banner
Advertisements
0 comments:
Post a Comment
No Abusive comment will be approved. Make comment related to Topic only.