求:JavaScript 倒计时 代码

来源:百度知道 编辑:UC知道 时间:2024/04/28 00:03:10
我要实现的功能如下:
1。我可以设置一个总时间(如:120分钟)
2。倒计时,显示还剩下xx分钟
3。时时显示一分钟一变(不刷新当前页面实现)
不行
和我想要实现的功能差很远

谢谢大家

怎么能防止刷新页面,不让时间重新计时?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<div id="timeShow">不是吧。。</div>
<script language="javascript">
var times = 63;
showTime();
function showTime(){
document.getElementById("timeShow").innerHTML = "剩余时间:"+parseInt(times/60)+"分,即"+times+"秒";
--times;
if(times>0)
setTimeout("sh