What Are These?

Wednesday, 15 July 2009

Cycling/rotation for picture with link

Because of limited area of blog this method is good enough, due to a single picture in display only. you can customize between each of pictures with links : for the length of display, how many pictures with links and same dimension of the picture. This method totally different with marquee because no transitions method in between.

Did you wants to change automatic any picture with out any of transition mode? This is (not marquee/sliding) with link, copy and paste the code below.


<script type="text/javascript">

var imgs1 = new Array(

"http://banner1.gif",

"http://banner2.gif",

"http://banner3.gif",

"http://banner4.gif", this is for the picture change with yours

"http://banner5.gif",

"http://banner6.gif",

"http://banner7.gif",

"http://banner8.gif");


var lnks1 = new Array(

"http://yourlink1",

"http://yourlink2",

"http://yourlink3",

"http://yourlink4", this is for your link change with yours

"http://yourlink5",

"http://yourlink6",

"http://yourlink7",

"http://yourlink8");


var alt1 = new Array(); var currentAd1 = 0;

var imgCt1 = 8; 8 indicated how many picture and link

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);
</script>
<a id="adLink1" http://yourlink1 href="" target="_top">
<img id="adBanner1" border="0"
width="468" src="http://banner1.gif" height="60"/></a>

note
Those example using dimension of 468X60
3000 for how long it will display
It works up to 12 as per my experiences
To work properly the dimension of the picture is should be same likes 468X 60 all, 125X125, 200X50 and so on.
have a nice try.

May be you interested :


1 comments:

Anonymous said...

It's actually a great and useful piece of information. I am glad that you shared this useful info with us. Please keep us up to date like this. Thank you for sharing.

Look into my page ... social bookmarks service

Post a Comment

Followers