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[*/
#mss {
position:relative;width:100px;height:100px;
}
.frame {
position:relative;width:102px;height:102px;margin-Top:10px;
}
.frame IMG{
width:100px;height:100px;border:solid red 1px
}
.frame DIV{
position:absolute;left:5px;top:5px;width:80px;background-Color:#FFFFCC;border:solid red 1px;
}
/*]]>*/
</style></head>
<body>
<div id="mss" onmouseover="zxcMultiFrame.Pause('mss');" onmouseout="zxcMultiFrame.Auto('mss');">
</div>
<script type="text/javascript">
/*<![CDATA[*/
var zxcMultiFrame={
Auto:function(id,ms){
var oop=this,o=this['zxc'+id];
if (o){
o.to=setTimeout(function(){ oop.rotate(o); },ms||200);
}
},
Pause:function(id){
var oop=this,o=this['zxc'+id];
if (o){
clearTimeout(o.to);
}
},
init:function(o){
var id=o.ParentID,cls=o.FrameClass,nu=o.FrameNumer,ary=o.ImageArray,obj=document.getElementById(id);
if (obj){
var src,z0=0;
for (var z0=0;z0<ary.length;z0++){
src=ary[z0][0];
ary[z0][0]=new Image();
ary[z0][0].src=src;
}
this['zxc'+id]=o;
o.id=id;
o.obj=obj;
o.cls=cls;
o.nu=nu;
o.ary=ary;
o.fcnt=-1;
o.icnt=-1;
o.ms=o.HoldDelay;
o.frames=[];
this.load(o,obj,nu,cls);
}
},
load:function(o,obj,nu,cls){
for (var oop=this,z0=0;z0<o.ary.length;z0++){
if (o.ary[z0][0].width<40){
o.to=setTimeout(function(){ oop.load(o,obj,nu,cls); },200);
return;
}
}
for (var a,i,d,t,z1=0;z1<nu;z1++){
d=document.createElement('DIV');
d.className=cls;
a=document.createElement('A');
o.ary[z1][2]?a.href=o.ary[z1][2]:null;
d.appendChild(a);
i=document.createElement('IMG');
a.appendChild(i);
t=document.createElement('DIV');
d.appendChild(t);
obj.appendChild(d);
o.frames[z1]=[d,a,i,t];
}
oop.rotate(o);
},
rotate:function(o){
clearTimeout(o.to);
o.fcnt=++o.fcnt%o.nu;
if (o.fcnt==0){
for (var z0=0;z0<o.nu;z0++){
o.icnt=++o.icnt%o.ary.length;
o.frames[z0][1].removeAttribute('href');
o.ary[o.icnt][2]?o.frames[z0][1].href=o.ary[o.icnt][2]:null;
o.frames[z0][2].src=o.ary[o.icnt][0].src;
o.frames[z0][3].innerHTML=o.ary[z0][1]?o.ary[z0][1]:'';
this.opc(o.frames[z0][0],o.Opacity[0]*100);
}
}
this.opc(o.frames[o.fcnt][0],o.Opacity[1]*100);
this.Auto(o.id,o.ms);
},
opc:function(o,opc){
o.style.filter='alpha(opacity='+opc+')';
o.style.opacity=o.style.MozOpacity=o.style.WebkitOpacity=o.style.KhtmlOpacity=opc/100-.001;
}
}
zxcMultiFrame.init({
ParentID:'mss',
FrameClass:'frame',
FrameNumer:3,
Opacity:[0.2,1],
HoldDelay:2000,
ImageArray:[
['http://www.vicsjavascripts.org.uk/StdImages/1.gif','My Text 1','http://www.vicsjavascripts.org.uk/'],
['http://www.vicsjavascripts.org.uk/StdImages/2.gif','My Text 2',''],
['http://www.vicsjavascripts.org.uk/StdImages/3.gif','My Text 3',''],
['http://www.vicsjavascripts.org.uk/StdImages/4.gif','My Text 4',''],
['http://www.vicsjavascripts.org.uk/StdImages/5.gif','My Text 5',''],
['http://www.vicsjavascripts.org.uk/StdImages/6.gif','My Text 6','']
]
});
/*]]>*/
</script>
</body>
</html>
Bookmarks