• 变换显示数据库图片(3/3)


    很久没有发技术性的了,今天发一个.以后会多发一些的.

    <!--firefox不能完整支持,只能循环图象,不能通过鼠标放置后改变当前图象,并且下面的轮显无效
    -->
    <!--#include file="inc/conn.asp"-->

    <SCRIPT language=vbscript id=clientEventHandlersVBS>
    <!--
    Dim mySt(4)
    mySt(0)=mySt(1)=mySt(2)=mySt(3)=mySt(4)=0

    Sub myd1_onmouseover
     myd1.style.color="white" 
     CALL changeimg(0)
    End Sub

    Sub myd2_onmouseover
     myd2.style.color="white" 
     CALL changeimg(1)
    End Sub

    Sub myd3_onmouseover
     myd3.style.color="white" 
     CALL changeimg(2)
    End Sub

    Sub myd4_onmouseover
     myd4.style.color="white" 
     CALL changeimg(3)
    End Sub

    Sub myd5_onmouseover
     myd5.style.color="white" 
     CALL changeimg(4)
    End Sub
    -->
     </SCRIPT>
    <%Set rs=Server.CreateObject("ADODB.Recordset")
    sql="select top 5 * from product  where elite=true order by updatetime desc"
    rs.open sql,conn,1,1%>

    <SCRIPT language=javascript>
    <!--
    var cpAD=new Array();
    var cpADlink=new Array();
    var adNum=5;
    var coll=0;

    //bookpic/20068723591570655.jpg


    //
    <%i=-1'因为要从0计数
    do while not rs.eof
    i=i+1
    %>
    cpAD[<%=i%>]="<%=rs("bookpic")%>";//图片路径
    cpADlink[<%=i%>]="productshow.asp?articleid=<%=rs("articleid")%>";//链接地址
    <%

    rs.movenext
    loop
    rs.close
    set rs=nothing%>


    var preloadedimages=new Array();
    for (i=1;i<cpAD.length;i++){
    preloadedimages[i]=new Image();
    preloadedimages[i].src=cpAD[i];
    }

    function jump2url()
    {
    jumpUrl=cpADlink[adNum];
    jumpTarget='_blank';
    if (jumpUrl != '')
    {
     if (jumpTarget != '')
      window.open(jumpUrl,jumpTarget);
     else location.href=jumpUrl;
     }
    }
    function changeimg(n)
    {
     adNum=n;
     window.clearInterval(theTimer);
     adNum=adNum-1;
     nextAd(); 
    }

    function nextAd(){
    coll++;

    if(adNum<cpAD.length-1)
    {
     adNum++ ;
    }
    else
    {
     adNum=0;
    }
    setAllcolor();
    if(adNum==0)
     myd1.background="http://www.huachu.com.cn/images/a+.gif";//当前的文字层背景
    if(adNum==1)
     myd2.background="http://www.huachu.com.cn/images/a+.gif";
    if(adNum==2)
     myd3.background="http://www.huachu.com.cn/images/a+.gif";
    if(adNum==3)
     myd4.background="http://www.huachu.com.cn/images/a+.gif";
    if(adNum==4)
     myd5.background="http://www.huachu.com.cn/images/a+.gif";
     
    setTransition();
    document.images.cpADrush.src=cpAD[adNum];
    playTransition();
    theTimer=setTimeout("nextAd()", 8000); //每个图象显示时间
    }

    function setAllcolor()
    {  
      myd1.background="http://www.huachu.com.cn/images/a.gif";//非当前的文字所在背景
      myd2.background="http://www.huachu.com.cn/images/a.gif";
      myd3.background="http://www.huachu.com.cn/images/a.gif";
      myd4.background="http://www.huachu.com.cn/images/a.gif";
      myd5.background="http://www.huachu.com.cn/images/a.gif";
    }

    function setTransition(){
    if (document.all){
    cpADrush.filters.revealTrans.Transition=23;
    cpADrush.filters.revealTrans.apply();
    }

    }
    function playTransition(){
    if (document.all)
    cpADrush.filters.revealTrans.play()
    }


    //-->
     </SCRIPT>
                <TABLE height=150 cellSpacing=0 cellPadding=0 border=0>
                  <TBODY>
                  <TR>
                    <TD>
        <A href="javascript:jump2url()"><IMG
                      style="FILTER: revealTrans(duration=2,transition=23)"
                      height=150
                      src=""
                      width=550 border=0 name=cpADrush></A></TD></TR>
                  <TR>
                    <TD height=1></TD></TR>
                  <TR>
                    <TD>
                      <TABLE id=T1 height=22 cellSpacing=0 cellPadding=0 width=550
                      bgColor=#ffffff border=0 name="T1">
                        <TBODY>
                        <TR bgColor=#ce0408>
                          <TD bgColor=#291018>&nbsp;</TD>
                          <TD width=1 bgColor=#ffffff></TD>
    <%Set rs2=Server.CreateObject("ADODB.Recordset")
    rs2.open sql,conn,1,1%>
    <%
    j=0
    Do While Not rs2.eof
    j=j+1
    myid="myd"&j%>
                          <TD id=<%=myid%>
                          style="FONT-SIZE: 12px; COLOR: #ffffff; FONT-FAMILY: "
                          onclick=changeimg(0) width="16%"
                          background="808/a.gif"
                          height=10 name="<%=myid%>"><DIV align=center><%=rs2("product_id")%></DIV></TD>
                          <TD width=1 bgColor=#ffffff></TD>                    
    <%rs2.movenext
    Loop
    rs2.close%>
                          <TD bgColor=#291018>&nbsp;</TD></TR></TBODY></TABLE>
                      <SCRIPT language=JavaScript>nextAd()</SCRIPT>
                    </TD></TR></TBODY></TABLE>
     

  • 相关阅读:
    SpringMVC视图解析器
    FreeMarker介绍
    一篇很全面的freemarker教程
    request,session,application
    nav布局 在线演示 DIVCSS5
    opacity
    java 某字符串在另一字符串中是否存在
    bochs 使用讲解
    使用VS2015搭建Lua开发环境
    Zip文件格式
  • 原文地址:https://www.cnblogs.com/zerogo/p/2209384.html
Copyright © 2020-2023  润新知