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:absolute;left:100px;top:100px;width:400px;height:50px;
}
,div {
height:50px;width:100%;
}
/*]]>*/
</style></head>
<body>
<div id="tst" onmouseover="zxcRandomRotate.Pause('tst');" onmouseout="zxcRandomRotate.Auto('tst');">
<div class="div" style="background-Color:red;" >Any HTML 1</div>
<div class="div" style="background-Color:green;" >Any HTML 2</div>
<div class="div" style="background-Color:blue;" >Any HTML 3</div>
</div>
<script> vic=0; </script>
<form name=Show id=Show style="position:absolute;visibility:visible;top:700px;left:0px;" >
<input size=100 name=Show0 >
<input size=10 name=Show1 >
<input size=10 name=Show2 >
<input size=10 name=Show3 >
<input size=10 name=Show4 >
<input size=10 name=Show5 >
<input size=10 name=Show6 >
<input size=10 name=Show7 >
<input size=10 name=Show8 >
<input size=10 name=Show9 ><br>
<textarea name=TA rows=1 cols=100 ></textarea>
</form>
<script type="text/javascript">
/*<![CDATA[*/
var zxcRandomRotate={
init:function(o){
var id=o.ID,hold=o.Hold,obj=document.getElementById(id),clds=obj.childNodes,ary=[],z0=0;
for (;z0<clds.length;z0++){
if (clds[z0].nodeType==1){
clds[z0].style.position='absolute';
clds[z0].style.zIndex='0';
clds[z0].style.left='0px';
clds[z0].style.top='0px';
ary.push(clds[z0]);
}
}
o=this['zxc'+id]={
id:id,
ary:ary,
hold:typeof(hold)=='number'?hold:5000,
nu:-1
}
this.rotate(o);
},
Auto:function(id){
var o=this['zxc'+id],oop=this;
if (o){
o.to=setTimeout(function(){ oop.rotate(o); },500);
}
},
Pause:function(id){
var o=this['zxc'+id];
if (o){
clearTimeout(o.to);
}
},
rotate:function(o){
var nu=Math.floor(Math.random()*o.ary.length),oop=this;
while (nu==o.nu){
nu=Math.floor(Math.random()*o.ary.length);
}
if (o.ary[o.nu]){
o.ary[o.nu].style.zIndex='0';
}
o.ary[nu].style.zIndex='1';
o.nu=nu;
o.to=setTimeout(function(){ oop.Auto(o.id); },o.hold);
}
}
zxcRandomRotate.init({
ID:'tst',
Hold:2000
});
/*]]>*/
</script>
</body>
</html>
Bookmarks