that is a very old script
try
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<style type="text/css">
/*<![CDATA[*/
#tst {
position:relative;width:250px;height:200px;
}
#tst2 {
position:relative;width:250px;height:200px;
}
#tst2 IMG {
position:relative;width:150px;height:150px;
}
/*]]>*/
</style>
<script type="text/javascript">
function zxcImageSlider(o){
var p=document.getElementById(o.ID),oop=this;
p.style.overflow='hidden';
this.cnt=p.getElementsByTagName('IMG')[0]?1:0;
var path=o.ImagePath||'';
this.imgary=[];
for (var z0=0;z0<o.ImageArray.length;z0++){
this.imgary[z0]=new Image();
this.imgary[z0].src=path+o.ImageArray[z0];
}
this.min=-p.offsetWidth;
this.frames=[];
var f1=document.createElement('DIV');
f1.style.position='absolute';
f1.style.zIndex='1';
f1.style.backgroundColor=o.BackgroundColor||'#FFFFFF';
f1.style.width=p.offsetWidth+'px';
f1.style.height=p.offsetHeight+'px';
f1.style.left=this.min+'px';
f1.style.top='0px';
p.appendChild(f1);
var img1=document.createElement('IMG');
img1.style.position='absolute';
img1.style.left='0px';
img1.style.top='0px';
img1.src=this.imgary[0].src;
f1.appendChild(img1);
var f2=f1.cloneNode(true);
f2.getElementsByTagName('IMG')[0].src=this.imgary[1].src;
p.appendChild(f2);
this.frames=[f1,f2];
this.ms=o.Speed||20;
this.hold=o.Hold||this.ms*10;
this.Increment=o.Increment||1;
setTimeout(function(){ oop.swap(); },this.hold);
}
zxcImageSlider.prototype={
swap:function(){
if (this.imgary[this.cnt].width>40){
this.frames.reverse();
this.frames[0].style.zIndex='1';
this.frames[1].style.zIndex='2';
var img=this.frames[1].getElementsByTagName('IMG')[0];
img.style.left=(this.frames[1].offsetWidth-img.width)/2+'px';
img.style.top=(this.frames[1].offsetHeight-img.height)/2+'px';
img.src=this.imgary[this.cnt].src;
this.cnt=++this.cnt%this.imgary.length;
this.rotate(this.min);
}
else {
this.cnt=++this.cnt%this.imgary.length;
var oop=this;
setTimeout(function(){ oop.swap(); },10);
}
},
rotate:function(lft){
var oop=this;
this.frames[1].style.left=lft+'px';
lft+=this.Increment;
if (lft<1){
setTimeout(function(){ oop.rotate(lft); },this.ms);
}
else {
this.frames[1].style.left='0px';
setTimeout(function(){ oop.swap(); },this.hold);
}
}
}
</script>
</head>
<body>
<div id="tst" onmouseover="S.Increment=0;" onmouseout="S.Increment=1;">
<img src="http://www.australianartilleryassociation.com/australian_artillery_association/home_page_slideshow/arty_badge_001.jpg" />
</div>
<div id="tst2" onmouseover="S1.Increment=0;" onmouseout="S1.Increment=1;">
</div>
<script type="text/javascript">
/*<![CDATA[*/
var S=new zxcImageSlider({
ID:'tst',
BackgroundColor:'#ffffff',
ImagePath:'http://www.australianartilleryassociation.com/australian_artillery_association/home_page_slideshow/',
ImageArray:[
'arty_badge_001.jpg',
'arty_badge_002.gif',
'arty_badge_003.jpg',
'arty_badge_004.gif',
'arty_badge_005.jpg',
'arty_badge_006.gif',
'arty_badge_007.png',
'arty_badge_008.jpg',
'arty_badge_009.gif',
'arty_badge_010.jpg',
'arty_badge_011.jpg'
],
Increment:1,
Speed:10, // fast = 10, slow = 100
Hold:2000
});
var S1=new zxcImageSlider({
ID:'tst2',
ImagePath:'http://www.australianartilleryassociation.com/australian_artillery_association/home_page_slideshow/',
ImageArray:[
'arty_badge_001.jpg',
'arty_badge_002.gif',
'arty_badge_003.jpg',
'arty_badge_004.gif',
'arty_badge_005.jpg',
]
});
/*]]>*/
</script>
</body>
</html>
Bookmarks