一个图片切换效果

在南京擎天科技的门户主页上面(http://www.skynj.com/webpages/about.jsp),有这么一个图片上实现自动滚入滚出,通过如下可以达到:

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>图片自动滚入滚出</title>
</head>
  <script language="JavaScript"> //js代码

                            var ar=new Array(); //用于存放图片路径(相对路径)

                            var nextNum=0;
                            ar[0]="image/01.jpg";
                            ar[1]="image/02.jpg";
                            ar[2]="image/03.jpg";
                            ar[3]="image/04.jpg";
                        

 

                            function setTransition(){

                                          if (document.all){

                                          arrotator.filters.revealTrans.Transition=Math.floor(Math.random()*23);//设置图片切换

                                                        arrotator.filters.revealTrans.apply(); //应用图片切换

                                          }

                            }

                            function playTransition(){

                                          if (document.all)

                                                        arrotator.filters.revealTrans.play() //播放图片

                            }

                            function changePic(){

                                          if(nextNum<ar.length-1)nextNum++;

                                          else nextNum=0;

                                          setTransition();

                                          document.images.arrotator.src=ar[nextNum];

                                          playTransition();

                                          theTimer=setTimeout("changePic()", 3000); //3秒钟切换一张图片

                            }

                            </script>

<body>

              <table  border="0" cellspacing="0" cellpadding="0">

              <tr  align="center">

                            <td width="870" height="140"  align="center">


                          <img style="filter: revealTrans(duration=3,transition=20)"     width="805" height="280"  name=arrotator>

                            <script language="JavaScript">changePic()</script>

                            </td>

              </tr>
               </table>
</body>
</html>

posted on 2012-01-18 08:51  平安夜  阅读(1307)  评论(2编辑  收藏  举报