javascript写的图片转换

 

< 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();" >
< href ="http://www.google.com"  target ="_blank" >< img  src ="images/00logo.gif"  id ="img"  width ="100"  height ="100"   /></ a >
</ body >
</ html >


Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=818173
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值