<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
.font72 {
font-size: 100px;
color: #FF0000;
font-family: "黑体";
background-color: #0000FF;
border: none;
}
-->
</style>
</head><body bgcolor="#0000FF">
<SCRIPT LANGUAGE="JavaScript"><!-- Begin
// Take user here after session timed out
timedouturl = "http://www.baron.com.cn";function Minutes(data) {
for (var i = 0; i < data.length; i++)
if (data.substring(i, i + 1) == ":")
break;
return (data.substring(0, i));
}
function Seconds(data) {
for (var i = 0; i < data.length; i++)
if (data.substring(i, i + 1) == ":")
break;
return (data.substring(i + 1, data.length));
}
function Display(min, sec) {
var disp;
if (min <= 9) disp = " 0";
else disp = " ";
disp += min + ":";
if (sec <= 9) disp += "0" + sec;
else disp += sec;
return (disp);
}
function set_time(){
document.timerform.clock.value=document.timerform.f.value+":"+document.timerform.m.value}
function Down() {
sec--;
if (sec == -1) { sec = 59; min--; }
document.timerform.clock.value = Display(min, sec);
window.status = "倒计时: " + Display(min, sec);
if (min == 0 && sec == 0) {
alert("时间到!!!");
//window.location.href = timedouturl;
}
else down = setTimeout("Down()", 1000);
}
function timeIt() {
if(document.timerform.ssbutton1.value=="开 始"){
document.timerform.ssbutton1.value="暂 停"
min = 1 * Minutes(document.timerform.clock.value);
sec = 0 + Seconds(document.timerform.clock.value);
Down();
}
else{
document.timerform.ssbutton1.value="开 始";
clearTimeout(down);
}
}function wait()
{
document.timerform.ssbutton2. disabled=true;
document.timerform.ssbutton1. disabled=false;
clearTimeout(down);
}// End -->
</script>
<center>
<form name="timerform">
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p><input name="clock" type="text" class="font72" value="00:00" size="7" readonly="yes">
</p><p>
<p>
<p>
<p>
<p align="left">
<input name="f" type="text" id="f" size="4">
分
<input name="m" type="text" id="m" size="4">
秒
<input type="BUTTON" value="设置时间" onClick="set_time()">
<input type="BUTTON" name="ssbutton1" value="开 始" onClick="timeIt()">
<!--<input type="BUTTON" name="ssbutton2" value="暂 停" onClick="wait()">-->
</form>
</center>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
.font72 {
font-size: 100px;
color: #FF0000;
font-family: "黑体";
background-color: #0000FF;
border: none;
}
-->
</style>
</head><body bgcolor="#0000FF">
<SCRIPT LANGUAGE="JavaScript"><!-- Begin
// Take user here after session timed out
timedouturl = "http://www.baron.com.cn";function Minutes(data) {
for (var i = 0; i < data.length; i++)
if (data.substring(i, i + 1) == ":")
break;
return (data.substring(0, i));
}
function Seconds(data) {
for (var i = 0; i < data.length; i++)
if (data.substring(i, i + 1) == ":")
break;
return (data.substring(i + 1, data.length));
}
function Display(min, sec) {
var disp;
if (min <= 9) disp = " 0";
else disp = " ";
disp += min + ":";
if (sec <= 9) disp += "0" + sec;
else disp += sec;
return (disp);
}
function set_time(){
document.timerform.clock.value=document.timerform.f.value+":"+document.timerform.m.value}
function Down() {
sec--;
if (sec == -1) { sec = 59; min--; }
document.timerform.clock.value = Display(min, sec);
window.status = "倒计时: " + Display(min, sec);
if (min == 0 && sec == 0) {
alert("时间到!!!");
//window.location.href = timedouturl;
}
else down = setTimeout("Down()", 1000);
}
function timeIt() {
if(document.timerform.ssbutton1.value=="开 始"){
document.timerform.ssbutton1.value="暂 停"
min = 1 * Minutes(document.timerform.clock.value);
sec = 0 + Seconds(document.timerform.clock.value);
Down();
}
else{
document.timerform.ssbutton1.value="开 始";
clearTimeout(down);
}
}function wait()
{
document.timerform.ssbutton2. disabled=true;
document.timerform.ssbutton1. disabled=false;
clearTimeout(down);
}// End -->
</script>
<center>
<form name="timerform">
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p><input name="clock" type="text" class="font72" value="00:00" size="7" readonly="yes">
</p><p>
<p>
<p>
<p>
<p align="left">
<input name="f" type="text" id="f" size="4">
分
<input name="m" type="text" id="m" size="4">
秒
<input type="BUTTON" value="设置时间" onClick="set_time()">
<input type="BUTTON" name="ssbutton1" value="开 始" onClick="timeIt()">
<!--<input type="BUTTON" name="ssbutton2" value="暂 停" onClick="wait()">-->
</form>
</center>
</body>
</html>
<script>
document.onkeypress = function(){
if(event.keyCode==32){
if(document.all.ssbutton1.value=="开 始"){
document.all.ssbutton1.value="暂 停";
timeIt();
}else{
document.all.ssbutton1.value="开 始";
wait();
}
}
}
</script>
</head><input type="BUTTON" name="ssbutton1" value="开 始" onClick="if(value=='开 始'){value='暂 停';timeIt();}else{value='开 始';wait();}">
<script>
var isPlay=false;
document.onkeypress = function(){
if(event.keyCode==32){
if(isPlay=="开 始"){
isPlay=true;
timeIt();
}else{
isPlay=false;
wait();
}
}
}
</script>
</head>