Cool Javascript|slideshow function|rotator funtion

June 20, 2008 - 10:15 am

This function is compatible with any web extension. Html, AsP, PHP, etc….
It’s cool and easy to manipulate, this way you don’t need any flash animation or  gif images. Just normal slideshow for banner rotator or photo album slideshow.

1. What to put in the <head>:
<script type=”text/javascript”>
var imgs1 = new Array(”images/banner1.jpg”,”images/banner2.jpg”,”images/banner3.jpg”);
<!–images–>
var lnks1 = new Array(”index.asp”,”index.asp”,”index.asp”);
var alt1 = new Array(”MVS - BVBA”,”MVS - BVBA”,”MVS - BVBA”);
var currentAd1 = 0;
var imgCt1 = 3;
<!– the total images that will be use–>
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()”,3000);
<!– the time interval = the time limit between the images–>

</script>

</head>

2. What to put in the <body>:

<tr>
<td align=”left” valign=”top”><a href=”"urllink1“” id=”adLink1” target=”_top”><img src=”images/banner1.jpg“  alt=”MVS - BVBA” width=”780″ height=”329″ “id=”adBanner1” border=”0″/></a></td>
</tr>

</body>

Well done - with this easy function you can rotate any banner or header images how many and how long you want to display on your website.

— Groeten, Rofaldez —

Leave a Reply

You must be logged in to post a comment.