首 页免费资源建站技术源码下载软件下载精品淘吧客户留言
用户登陆 | 用户注册
您当前的位置:笃志小屋建站技术特效代码其它特效 → 文章内容
JavaScript幻灯片效果
作者:本站  来源:本站整理  发布时间:2007-6-6 9:17:31

<!-- 完整的HTML代码如下 -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">

<META NAME="Description" CONTENT="">
</HEAD>

<BODY>
<div align="center"><div id=AdRotator></div><input id="second"><button onclick="adRotator.set(getRef('second').value)">set time</button></div>
<SCRIPT LANGUAGE="JavaScript">

<!--
function adRotator() {};
adRotator.initialize=function(o)
{
 // script by blueDestiny

 this._t = new Array();
 this._l = new Array();
 this._p = new Array();
 this._i = new Image();
 this._c = 0;
 this._f = false;
 this._o = o;

 this._timeout = null;
 this._html = "";

 // configration.
 // @ image width
 // @ image height
 // @ rotator speed
 // @ filter type

 this._w = 450;
 this._h = 450;
 this._s = 4;
 this._x = 23;

 return this;
};
adRotator.add=function(p,t,l) { with (this)
{
 _p.push(p);
 _t.push(t);
 _l.push(l);
}};

adRotator.load=function() { with (adRotator)
{
 if( _i.readyState=='complete' )
 {
  if(_p.length-1==_c)
  {
   _f = true;
   _c = 0;
   window.clearTimeout(_timeout);
   //getRef("AdRotator").innerHTML="complete";
   adRotator.play();
  }
  else
  {
   _c++;
   getRef(_o).innerHTML="total images " + _p.length + ", loading picture " + _c + ' ' + _i.readyState + "...";
   _timeout=window.setTimeout(adRotator.load,10)
  }
 }
 else
 {
  getRef(_o).innerHTML="total images " + _p.length + ", loading picture " + _c + ' ' + _i.readyState + "...";
  _timeout=window.setTimeout(adRotator.load,10)
 }
}};

adRotator.play=function() { with (adRotator)
{
 if( _f )
 {
 _html = "";
 _html += '<table style="border:1px solid #333333;"><tr><td style="font-size:9pt;font-family:tahoma;font-weight:bold;">'
 _html += '<div id="rotatorPlayer"'
   + ' style="width:' + _w + ''
   + ';height:"' + _h + '"'
   + '>'
 _html += '<a href="' + ( _l[_c] ? _l[_c] : "javascript:void(0);" ) + '">';
 _html += '<img id="rotatorPic" src="' + _p[_c] + '"'
   + ' width="' + _w + '"'
   + ' height="' + _h + '"'
   + (_t[_c]?' title="' + _t[_c] + '"':'')
   + ' style="border:1px solid blue;FILTER:revealTrans(transition=' + _x + ',duration=1);"'
   + ' >';
 _html += (_t[_c]?('<div align="center">' + (_c+1) + '. ' + _t[_c] + '</div>'):'<p></p>');
 _html += '</a>';
 _html += "</div>";
 _html += '<div align="right">';

 for(var i=0; i<_p.length; i++)
  _html += '<span'
     + ' style="border:1px solid #333333;padding:1px 5px 1px 5px;height:20px;text-align:center;cursor:'
     + (_c==i ? ('default;background-color:red;"') : 'hand;" onclick="adRotator.select(' + i + ')"')
     + '>'
     + (i>8?(i+1):('0'+(i+1)))+ '</span> ';

 _html += "</div></td></tr></table>";
 getRef(_o).innerHTML = _html;

 getRef("rotatorPic").filters[0].Apply();
 getRef("rotatorPic").filters[0].Play();

 next();
 }
 else
 {
  _i.src = _p[_c];
  adRotator.load();
 }
}};
adRotator.next=function() { with (this)
{
 (_p.length-1==_c) ? _c=0 : _c++;
 _timeout=window.setTimeout(adRotator.play,_s*1000);
}};
adRotator.select=function(i) { with (this)
{
 window.clearTimeout(_timeout);
 _c=i;
 adRotator.play();
}};
adRotator.set=function(second) { with (this)
{
 window.clearTimeout(_timeout);
 if((/\d+/).test(second)==true)
 {
  _s=second;
  adRotator.play();
 }
 else
 {
  alert("must be digit!")
  adRotator.play();
 }
}};
function getRef(id)
{
 return (document.all?document.all(id):document.getElementById(id));
}
adRotator.initialize("AdRotator");

adRotator.add("http://www.duzhi.net/skin/duzhi/logo.gif","duzhi","http://www.duzhi.net")
adRotator.add("http://img1.qq.com/ent/20060218/3215111.jpg")
adRotator.add("http://img1.qq.com/ent/20060218/3215112.jpg")
adRotator.add("http://img1.qq.com/ent/20060218/3215113.jpg")
adRotator.add("http://img1.qq.com/ent/20060218/3215114.jpg")

adRotator.play();
//-->

</SCRIPT>
</BODY>
</HTML>

把上边的代码保存成网页就,修改这里边的图片地址和连接
adRotator.add("http://www.duzhi.net/skin/duzhi/logo.gif","duzhi","http://www.duzhi.net")
就搞定了.

2007-6-6 9:17:31免费资源duzhi.net

[ ] [返回上一页] [打 印]

【笃志小屋duzhi.net】

  技术文章导航
  技术文章排行
  精彩推荐
Copyright www.duzhi.net All Right Reserved.
设计制作:翼迅设计室 Equick Desgin Home 在线QQ:303471038
网络备案号:冀ICP备06008201号 站长信箱:webmaster#duzhi.net(将#换为@)
本站部分文章和图片来源于网络和内容提供伙伴,如果侵犯了您的权利,请留言告知,本站定会及时删除相关文件!