1. 程式人生 > >jsp倒計時頁面自動跳轉

jsp倒計時頁面自動跳轉

<body style="overflow: auto;" onload="javascript:countDown(3);"> <!--在body中命名一個onload函式,在下邊的function中進行方法體操作  -->
<script type="text/javascript">
 function countDown(seconds) {
  document.getElementById("jump").innerHTML = seconds;//獲取id為jump標籤的內容
  if (--seconds > 0){//定義計時器,進行及時操作
   setTimeout("countDown(" + seconds + " )", 1000);
   }else{

   location.href="../accountant-server-salary";//所使用的框架為ssm,href後跟上所要訪問的地址或者方法地址

   }
 }
 </script>
<div style="margin-top: 200px;margin-left: 300px">
<table>
<tr>
<td>
<img alt="" src="<%=request.getContextPath()%>/images/crying_false.png">
</td>
<td id="text" style="font-size: 40pt;color: #444444;font-family: 楷體;font-weight: bold;">
找不到您要匯出的資料...
</td>
</tr>
<tr style="margin-top: 200px">
<td width="120px"></td>
<td style="font-family: 楷體;font-size: 20pt;font-weight: bold;color: #444444">
頁面將在<span id="jump" style="color:#EA2000"></span>秒後自動跳轉......
</td>
</tr>
</table>
</div>
</body>