zoukankan      html  css  js  c++  java
  • JSP实现页面自动跳转

    一些页面自动跳转的实现

    功能:

    8

    秒后,自动跳转到同目录下的

    return.html

    文件

    1

    html

    的实现

    <head>

    <meta http-equiv="refresh" content="5;url=return.html">

    </head>

    2

    javascript

    的实现

    <script language="javascript" type="text/javascript">

    setTimeout("javascript:location.href='return.html'", 8000);

    </script>

    3

    )结合了倒数的

    javascript

    实现(

    IE

    <span id="totalSecond">8</span>

    <script language="javascript" type="text/javascript">

    var second = totalSecond.innerText;

    setInterval("redirect()", 1000);

    function redirect(){

    totalSecond.innerText=--second;

    if(second<0) location.href='return.html';

    }

    </script>

    3'

    )结合了倒数的

    javascript

    实现(

    firefox

    <script language="javascript" type="text/javascript">

    var second = document.getElementById('totalSecond').textContent;

    setInterval("redirect()", 1000);

    function redirect()

    {

    document.getElementById('totalSecond').textContent = --second;

    if (second < 0) location.href = 'return.html';

    }

    </script>

    4

    )解决

    Firefox

    不支持

    innerText

    的问题

    <span id="totalSecond">8</span>

    <script language="javascript" type="text/javascript">

    if(navigator.appName.indexOf("Explorer") > -1){

    document.getElementById('totalSecond').innerText = "my text innerText";

    } else{

    document.getElementById('totalSecond').textContent = "my text textContent";

    }

    </script>

    5

    )整合

    3

    )和

    3'

    <span id="totalSecond">8</span>

    <script language="javascript" type="text/javascript">

    var second = document.getElementById('totalSecond').textContent;

    if (navigator.appName.indexOf("Explorer") > -1)

    {

    second = document.getElementById('totalSecond').innerText;

    } else

    {

    second = document.getElementById('totalSecond').textContent;

    }

    setInterval("redirect()", 1000);

    function redirect()

    {

    if (second < 0)

    {

    location.href = 'return.html';

    } else

    {

    if (navigator.appName.indexOf("Explorer") > -1)

    {

    document.getElementById('totalSecond').innerText = second--;

    } else

    {

    document.getElementById('totalSecond').textContent = second--;

    }

    }

    }

    </script>

    不在

    jsp

    页面中嵌套

    java

    代码片段

    <html>

    <head>

    <script type="text/javascript">

    function delayedRedirect(){

    window.location = http://localhost:8080/redirect/login.jsp;

    }

    </script>

    </head>

    <body onLoad="setTimeout('delayedRedirect()',3000)">

    <h2>3

    秒钟后将自动跳转到登陆页面

     </h2>

    </body>

    </html>

  • 相关阅读:
    一种安全云存储方案设计(上)——基于二次加密的存储策略与加密图文混合检索
    lamda表达式导致运行时VerifyError
    编译原理:语法分析概述
    语音识别与 RNN-Transducer 概述
    通信原理基本概念
    追光捉影的自动机:2021 卓工实训小作文
    【实战】jsfinder+jsinfo-scan结合改造
    js基础记录
    qq、微信二次分享
    收藏链接
  • 原文地址:https://www.cnblogs.com/hualidezhuanshen/p/3266256.html
Copyright © 2011-2022 走看看