加載中頁面代碼

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <base href="<%=basePath%>">

        <title>My JSP 'test.jsp' starting page</title>
<script type="text/javascript" src="js/jquery.js"></script>
    <style type="text/css">
            #loading{
            position:fixed; 
            right:50%;
            bottom:50%;
            z-index:1000;   
            display: none;          
            }
            #stop{
            display: none;
            }
      </style>
    <script type="text/javascript">

    function openWin(){
        document.getElementById( 'loading' ).style.display = 'block';
        document.getElementById( 'start' ).style.display = 'none';
        document.getElementById( 'stop' ).style.display = 'block';
    }
    function closeWin(){
        document.getElementById( 'loading' ).style.display = 'none';
        document.getElementById( 'stop' ).style.display = 'none';
        document.getElementById( 'start' ).style.display = 'block';
    }
    function openWin2(){
        document.getElementById( 'loading' ).style.display = 'block';
        setTimeout( closeWin2, 5000 ); /* 5秒後關閉,這裏你可以設置,單位毫秒 */
    }
    function closeWin2(){
        document.getElementById( 'loading' ).style.display = 'none';
    }
    </script>

    </head>

    <body>
        <div id="loading"><img src="images/loading.gif"/></div>
        <input id="start" type="button" value="開始加載" onclick="openWin()"/>
        <input id="stop" type="button" value="結束加載" onclick="closeWin()"/><br/>
        <input id="end" type="button" value="開始加載,5秒結束" onclick="openWin2()"/>
    </body>
</html>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章