• 倒计时显示


    <script type="text/javascript">
       var timer = window.setInterval("Timer()",1000);//启用定时倒计
       var secs = 5;
       function Timer() {
          secs--;
          document.getElementById("btnShow").innerHTML = "倒计时:[" + secs + "]";
          if(secs == 0){
              window.clearInterval(timer);//清楚定时任务
              window.location.href="地址";
          }
        }
    </script>
    

      实例

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>X-Open</title>
    <link type="text/css" rel="stylesheet"
        href="static/css/bootstrap.min.css">
    <script type="text/javascript" src="static/js/jquery.min.js"></script>
    <script type="text/javascript" src="static/js/bootstrap.min.js"></script>
    </head>
    <body style="margin: 0px;">
        <%@ include file="/WEB-INF/jsps/header.jsp"%>
        <!-- 内容部分 -->
        <div class="container">
            <div class="row">
                <div class="col col-md-12" style="text-align: center;">你注册成功啦<br>
                现在可以去<a href="<c:url value='/login.html'/>">登陆啦</a>
                <br>
                <label id="lable"></label>
                </div>
            </div>
        </div>
    </body>
    <!-- 倒计时脚本 -->
    <script type="text/javascript">
       var timer = window.setInterval("Timer()",1000);//启用定时倒计
       var secs = 5;
       function Timer() {
          secs--;
          document.getElementById("lable").innerHTML = secs+"秒以后自动跳转到登陆页面";
          if(secs == 0){
              window.clearInterval(timer);//清除定时任务
              window.location.href="<c:url value='/login.html'/>";
          }
        }
    </script>
    </html>
  • 相关阅读:
    nginx upstream permission denied错误解决
    基于Mariadb 10.6.4在CentOS 7环境下配置Galera Cluster集群
    K8s 开始
    RTSP H264/HEVC 流 Wasm 播放
    Netty编码示例(RPC & WbeSocket & Tomcat)
    Netty异步任务调度与异步线程池
    Netty编解码器&TCP粘包拆包
    Netty核心模块组件
    Neety编码示例(群聊系统&⼼跳检测&WebSocket⻓连接)
    Netty高性能架构设计
  • 原文地址:https://www.cnblogs.com/fujilong/p/5353378.html
Copyright © 2020-2023  润新知