liuxiaoyi666

  博客园  :: 首页  ::  :: 联系 :: 订阅 订阅  :: 管理

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script lanuage='javascript'>
function controlimg(imgid)
{
  this.objid=imgid;
  this.imgnum=0;
  this.imgarr=new Array(); 
}

controlimg.prototype.add=addimg;
controlimg.prototype.loadpic=preload;
controlimg.prototype.convert=changeimg;

function addimg(imgsrc,href)
{
  this.imgarr[this.imgarr.length]={
  "imgsrc":imgsrc,
  "href":href
  }
}

function preload(){
 for(i=0;i<this.imgarr.length;i++)
 {
   eval("img_"+this.objid+"_"+i+"=new Image()");
   eval("img_"+this.objid+"_"+i+".src=this.imgarr[i].imgsrc");
 }
}

function changeimg(picpos)
{
  if(this.imgnum>=this.imgarr.length)
  {
    this.imgnum=0;
  }
 /* if(picpos.length!=0)
  {
     this.imgnum=Math.round(picpos);
  }*/
  var obj_img=document.getElementById(this.objid);
  obj_img.style.filter=(obj_img.style.filter=="revealTrans")?"revealTrans":"blendTrans";
  obj_img.style.filter.duration = 3.0000;
  obj_img.style.filter.transition = 23;
  obj_img.filters(0).apply();
  obj_img.src=this.imgarr[this.imgnum].imgsrc;
  obj_img.parentNode.href=this.imgarr[this.imgnum].href;
  obj_img.filters(0).play();
  this.imgnum=this.imgnum+1;
  //window.setTimeout("changeimg()",3000);
}
var obj_convert;
function init()
{
  obj_convert=new controlimg("img")
  obj_convert.add("images/00logo.gif","http://www.google.com");
  obj_convert.add("images/0.gif","http://www.baidu.com");
  obj_convert.add("images/06top_42.gif","http://www.csdn.net");
  obj_convert.loadpic();
  window.setInterval("obj_convert.convert()",3000);
}

</script>
</head>

<body onload="init();">
<a href="http://www.google.com" target="_blank"><img src="images/00logo.gif" id="img" width="100" height="100" /></a>
</body>
</html>

posted on 2006-06-21 17:43  csdn兔  阅读(641)  评论(2编辑  收藏  举报