<table>
<tr>
<td width=200 align=center>
简介
</td>
<td width=200>
<dl id="album">
  <dt>
   <a id="href1"  href="http://www.baidu.com" target="_blank" ><img id="index1" alt="余秋的黄昏" src="images/sd/1xiao.JPG" /></a>
   <a id="href2"  href="http://www.126.com" target="_blank"><img id="index2" alt="美丽欧洲" src="images/sd/2xiao.JPG" /></a>
   <a id="href3"  href="http://www.163.com" target="_blank"><img id="index3" alt="巨石阵的神秘" src="images/sd/3xiao.JPG" /></a>
   <a id="href4"  href="http://www.sohu.com" target="_blank"><img id="index4" alt="巨石阵的神秘" src="images/sd/4xiao.JPG" /></a>
  </dt>
  <dd id = "ref" height="5px" >
<a href="#index1">1</a>
<a href="#index2">2</a>
<a href="#index3">3</a>
<a href="#index4">4</a>
  </dd>
</dl>
</td>
</tr>
<tr >
<td align=center colspan=2>
<a href="#index1">查看全文</a></td>
</tr>
</table>
<script type="text/javascript">
  function imageRotater(id){
    var cases = "",
    album = document.getElementById(id),
    images = album.getElementsByTagName("img"),
    ref = document.getElementById("ref"),
    links = ref.getElementsByTagName("a"),
    dt = album.getElementsByTagName("dt")[0],
    length = images.length,
    aIndex = 1,
    aBefore = length;
    for(var i=0;i< length;i++){
      cases += images[i].id + ':"'+images[i].getAttribute("src")+'",'
    }
    images[0].style.cssText = "position:absolute;top:0;left:0;";//修正图片位置错误
    var tip = document.createElement("dd");
    tip.style.cssText = "position:absolute;bottom:0;width:380px;height:10px;padding:5px;color:#fff;background:#fff;";
    album.insertBefore(tip,dt.nextSibling);
    if(!+"\v1"){
      tip.style.color = "#369";
      tip.style.filter = "alpha(opacity=67)"
    }else{
      tip.style.cssText += "background: rgba(164, 173, 183, .65);"
    }
    cases = eval("({"+cases.replace(/,$/,"")+"})");
    for(var i=0;i<length;i++){
      links[i].onclick = function(e){
        e =e || window.event;
        var index = this.toString().split("#")[1];
        aIndex = index.charAt(index.length-1);//☆☆☆☆
        images[0].src = cases[index];
        tip.innerHTML = images[aIndex -1].getAttribute("alt");
          !+"\v1" ?(e.returnValue = false) :(e.preventDefault());
      }
    }
    var prefix = images[0].id.substr(0,images[0].id.length -1);
    (function(){
      setTimeout(function(){
        if(aIndex > length){
          aIndex = 1;
        }
        images[0].src = cases[prefix+aIndex];
        tip.innerHTML = images[aIndex -1].getAttribute("alt");
        tip.style.bottom = "-40px";
        links[aBefore-1].className = "";
        links[aIndex-1].className = "hover";
        aBefore = aIndex;
        aIndex++;
        move(tip);
        setTimeout(arguments.callee,1500)
      },1500)
    })()
    var move = function(el){
      var begin = parseFloat(el.style.bottom),
      speed = 1;
      el.bottom = begin;
      (function(){
        setTimeout(function(){
          el.style.bottom = el.bottom + speed + "px";
          el.bottom += speed;
          speed *= 1.5;//下一次移动的距离
          if(el.bottom >= 0){
            el.style.bottom = "0px";
          }else{
            setTimeout(arguments.callee,23);
          }
        },25)
      })()
    }
  }
  window.onload = function(){
    try{document.execCommand("BackgroundImageCache", false, true);}catch(e){};
    imageRotater("album");
  }
</script>

解决方案 »

  1.   

    我写的一个图片轮换····
    <html >
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <script  language="javascript">
    var maxpic=3;
    var nowpic=1;
    function showPic(){
    for(var i=1;i<(maxpic+1);i++){
    if(i==nowpic){
    document.getElementById("pic"+nowpic).style.display="block";
    }
    else{
    document.getElementById("pic"+i).style.display="none";
    }

    }
    if(nowpic==maxpic){
    nowpic=1;
    }else{
    nowpic++;
    }
    setTimeout("showPic()",1000);
    }

    </script>
    </head><body onLoad="showPic()"><div align="center"> <a href="../../jszuoye/diliuzhang1.html"><img src="images/1.jpg" width="300" height="180"  id="pic1" style="display:none;"/></a>
      <a href="../../jszuoye/diliuzhang2.html"><img src="images/2.jpg" width="300" height="180" id="pic2" style="display:none;"/></a>
      <a href="../../jszuoye/diliuzhang3.html"><img src="images/3.jpg" width="300" height="180"  id="pic3"  style="display:none;"/></a>
    </div></body>
    </html