• 网页图片自动轮换


     1 <%@ page language="java" contentType="text/html; charset=UTF-8"
     2     pageEncoding="UTF-8"%>
     3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
     4 <html>
     5 <head>
     6 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     7 <title>Insert title here</title>
     8 <script type="text/javascript" src=js/jquery-1.7.2.min.js></script>
     9 <script type="text/javascript" src=js/jquery.easyui.min.js></script>
    10 <script type="text/javascript">
    11     function reloadImage() {
    12         document.getElementById('btn').disabled = ture;
    13         document.getElementById('identity').src = 'rdentity.do?ts='
    14                 + new Date().getTime();
    15     }
    16     
    17 
    18     var curIndex=0;
    19     //时间间隔(单位毫秒),每秒钟显示一张,数组共有5张图片放在Photos文件夹下。
    20     var timeInterval=1000;
    21     var arr=new Array();
    22     arr[0]="images/main1.png";
    23     arr[1]="images/main2.jpg";
    24     arr[2]="images/main3.jpg";
    25     
    26     setInterval(changeImg,timeInterval);
    27     function changeImg()
    28     {
    29         var obj=document.getElementById("obj");
    30         if (curIndex==arr.length-1) 
    31         {
    32             curIndex=0;
    33         }
    34         else
    35         {
    36             curIndex+=1;
    37         }
    38         obj.src=arr[curIndex];
    39     }
    40 </script>
    41 </head>
    42 <body>
    43 
    44     <img src="rdentity.do" id="identity" onload="btn.disabled=false;" />
    45     <input type="button" value="换个图片" onclick="reloadImage()" id="btn">
    46     
    47     
    48 
    49     <img id=obj src ="images/main1.png" width=200 height=150 border =0>
    50 </body>
    51 </html>
    View Code
  • 相关阅读:
    下载windows原装镜像的官方网站
    Typora快捷键
    UOS使用ZSH终端教程
    UOS每日折腾、调教、美化
    AMD64和X86_64
    CPU架构
    23种设计模式---单例设计模式(精华)
    java学习day32-Servlet上下文--ServletContext
    java学习day32-Servlet过滤器-Filter
    java学习day32-JSP标签技术-JSTL标签库
  • 原文地址:https://www.cnblogs.com/nin-w/p/5789771.html
Copyright © 2020-2023  润新知