js中的幻燈片(2)

来源:互联网 发布:淘宝电脑端描述图尺寸 编辑:程序博客网 时间:2024/06/05 04:39

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="powerpoint.aspx.cs" Inherits="powerpoint" %>
<META   http-equiv="Content-Type"   content="text/html;   charset=gb2312">  
  <style   type="text/css">   <!--   select   {   font-family:   "tahoma";   font-size:   10px;   color:   #666666}  
  input   {   font-family:   "tahoma";   font-size:   10px;   color:   #000000;   border:   #666666;   border-style:   solid;   border-top-width:   1px;   border-right-width:   1px;   border-bottom-width:   1px;   border-left-width:   1px}  
  --></style>  
  <SCRIPT   LANGUAGE="JavaScript">  

    

  var   rotate_delay   =   1000;   //   delay   in   milliseconds   (5000   =   5   secs)  
  current   =   0;  
  function   next()   {  
  if   (document.slideform.slide[current+1])   {  
  document.images.show.src   =   document.slideform.slide[current+1].value;  
  document.slideform.slide.selectedIndex   =   ++current;  
        }  
  else   first();  
  }  
  function   previous()   {  
  if   (current-1   >=   0)   {  
  document.images.show.src   =   document.slideform.slide[current-1].value;  
  document.slideform.slide.selectedIndex   =   --current;  
        }  
  else   last();  
  }  
  function   first()   {  
  current   =   0;  
  document.images.show.src   =   document.slideform.slide[0].value;  
  document.slideform.slide.selectedIndex   =   0;  
  }  
  function   last()   {  
  current   =   document.slideform.slide.length-1;  
  document.images.show.src   =   document.slideform.slide[current].value;  
  document.slideform.slide.selectedIndex   =   current;  
  }  
 
  function   change()   {  
  current   =   document.slideform.slide.selectedIndex;  
  document.images.show.src   =   document.slideform.slide[current].value;  
  }  
    function   ap(text)   {  
  document.slideform.slidebutton.value   =   (text   ==   "Stop")   ?   "Start"   :   "Stop";  
  rotate();  
  } 
  function   rotate()   {  
  if   (document.slideform.slidebutton.value   ==   "Stop")   {  
  current   =   (current   ==   document.slideform.slide.length-1)   ?   0   :   current+1;  
  document.images.show.src   =   document.slideform.slide[current].value;  
  document.slideform.slide.selectedIndex   =   current;  
  document.getElementById("lbl").innerHTML=document.slideform.slide[current].value;
  window.setTimeout("rotate()",   rotate_delay);  
        }  
      
  }  
  function addoption(text)
  {

 //document.getElementById("slide").options.add(new Option("text","value"));
alert(text);
  }
   
  </SCRIPT>  
  <body   bgcolor="#ffffff"   text="#000000">  
  <form   name="slideform">  
  <table   cellspacing="1"   cellpadding="4" style="background-color:Maroon">  
  <tr>  
  <td   align="center" style="background-color:white; width:200; height:200;">
   <asp:HyperLink ID="link" runat="server" NavigateUrl="http://news.163.com" Target=_blank>
 
<asp:Image runat="server" ID="show" Width=300 Height=220 />
  </asp:HyperLink> 
  <asp:Label runat="server" ID="lbl" ForeColor="red" Font-Bold="true" Font-Size="10pt" Width=180 />

  </td>  
  </tr>  
  <tr>  
  <td   align="center" style="background-color:Lime">  
  <select   name="slide"   onChange="change();">  
  <option   value="Images/patara03.gif"   selected>  
  1  
  <option   value="Images/190.gif">  
  2  
  <option   value="E:/web/AJAX/Web/Practice/Images/3.gif">  
  3  
  <option   value="E:/web/AJAX/Web/Practice/Images/4.gif">  
  4  
  <option   value="E:/web/AJAX/Web/Practice/Images/5.gif">  
  5  
  <option   value="E:/web/AJAX/Web/Practice/Images/6.gif">  
  6  

  </select>  

  </td>  
  </tr>  
  <tr>  
  <td   align="center"   bgcolor="#c0c0c0">  
  <input   type="button"   onClick="first();"   value="|<<"   title="Beginning">   <input   type="button"   onClick="previous();"   value="<<"   title="Previous">  
  <input   type="button"   name="slidebutton"   onClick="ap(this.value);"   value="开始"   title="AutoPlay">  
  <input   type="button"   onClick="next();"   value=">>"   title="Next">   <input   type="button"   onClick="last();"   value=">>|"   title="End">  
  </td>  
  </tr>  
  </table>  
  </form>  
  </body>