<title>
<style>
.k1{
height:10px;
width:10px;
border:1px #00F solid;
margin:2px;
float:right;
cursor:pointer;}
html,body{ width:100%; height:100%;}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
</style>
</head>
<body>
<div class="k1" style="background-color:#FFC" οnclick="changeColor('#ffffcc')"></div>
<div class="k1" style="background-color:#FCC" οnclick="changeColor('#ffcccc')"></div>
<div class="k1" style="background-color:#F9C" οnclick="changeColor('#ff99cc')"></div>
<div id="timediv" style="width:300px; height:18px; background-color:#FFF; border:dashed 1px #F33"></div>
<!-- 设置参赛团队参数 -->
<div style="float:left">
<font color="red" size="2">CSDN李伟 版权所有</font>,篮球竞赛专用,默认每节13分钟~ 设置比赛双方:
<input type="text" size="15" id="dui1" value="" /> VS
<input type="text" size="15" id="dui2" value="" />
<input value="设置" type="button" οnclick="dispDui()" />
</div>
<!-- 设置计时参数 -->
<div style="float:right">
<input type="button" id="btn_start" value="开始计时" οnclick="StartTime()" >
<input type="button" id="btn_pause" value="暂停计时" οnclick="PauseTime()" >
</div>
<script language="javascript" type="text/javascript">
function webTime(){
//产生一个日期时间对象
var date = new Date();
//显示到指定的位置
document.getElementById("timediv").innerHTML=date.toLocaleString();
//延迟一秒钟执行一次
setTimeout("webTime()",1000);
}
webTime();
</script>
<hr style="clear:both" />
<div id="content">
<!--table设置高度为100%,宽度为100%-->
<table width="100%" height="100%" style="width:100%; height:100%" cellspacing="0" cellpadding="0">
<tr>
<td style="width:100%; height:15px; text-align:center">
</td>
</tr>
<tr>
<td style="width:100%; height:100%">
<div id="dispDui" style=" height:50px; font-size:50px;text-align:center;">
<table align="center" width:100%;>
<tr>
<td colspan="3">
<div id="timer" style="font-size:30px;text-align:center;color:green;"> </div>
</td>
</tr>
<tr>
<td><div id="ldui" style="color:red"></div></td>
<td><span style="font-size:30px;"><-- VS --></span></td>
<td><div id="rdui" style="color:blue"></div></td>
</tr>
</table>
</div>
<div id="score" style=" height:300px; font-size:300px;text-align:center;">
<table align="center">
<tr>
<td><div id="lscore" style="color:red">00</div></td>
<td>:</td>
<td><div id="rscore" style="color:blue">00</div></td>
</tr>
</table>
</div>
<div id="bottom" style=" height:50px; font-size:50px;text-align:center;">
<table align="center">
<tr>
<td>
<input type="button" value="+" οnclick="opt('+','lscore')"><input type="button" value="-" οnclick="opt('-','lscore')">
</td>
<td>|</td>
<td>
<input type="button" value="+" οnclick="opt('+','rscore')"><input type="button" value="-" οnclick="opt('-','rscore')">
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>
<script language="javascript" type="text/javascript">
function changeColor(color){
//设置背景颜色
document.bgColor=color;
}
function changeSize(size){
//获取div对象
document.getElementById("content").style.fontSize=size+"px";
}
function dispDui(){
document.getElementById("ldui").innerHTML=document.getElementById("dui1").value;
document.getElementById("rdui").innerHTML=document.getElementById("dui2").value;
}
function opt(op,dir){
document.getElementById(dir).innerHTML=eval(document.getElementById(dir).innerHTML+op+1);
}
//------------------------配置默认本节时间-----------
var maxtime = 13*60 //一个小时,按秒计算,自己调整!
var timer;
function CountDown(){
if(maxtime>=0){
minutes = Math.floor(maxtime/60);
seconds = Math.floor(maxtime%60);
msg = "距本节比赛结束还有:"+minutes+"分"+seconds+"秒";
document.getElementById("timer").innerHTML=msg;
if(maxtime == 3*60) alert('注意,还有3分钟!');
--maxtime;
}
else{
clearInterval(timer);
//------------------------本节结束,配置下节时长,一般都一致-----------
maxtime = 13*60;
document.getElementById("timer").innerHTML="本节结束!!";
document.getElementById("btn_start").disabled=false;
}
}
function StartTime(){
document.getElementById("btn_pause").disabled=false;
timer = setInterval("CountDown()",1000);
document.getElementById("btn_start").disabled=true;
}
function PauseTime(){
clearInterval(timer);
document.getElementById("btn_start").disabled=false;
document.getElementById("btn_pause").disabled=true;
}
</script>