<html>
<head></head>
<STYLE TYPE="text/css">
body { font-size:12px; font-family:"宋体"; color:red; }
#sheng1 span { color:black; }
#time { color:blue; font-family:"微软雅黑"; }
</STYLE>
<body>
现在时间是:<DIV id="time"></DIV>
<DIV id="sheng1"></DIV>
<SCRIPT LANGUAGE="JavaScript">
<!--
function time()
{
var now,h,m,s;
now=new Date();
h = now.getHours();
m =now.getMinutes();
s = now.getSeconds();
if(h<10) h="0"+h;
if(m<10) m="0"+m;
if(s<10) s="0"+s;
document.getElementById("time").innerHTML=""+ h + ":" + m + ":" + s;
setTimeout("time();", 1000);
}
time();
var strm1="2010-11-13-22-17-00";
function timem1()
{
var arr1=strm1.split("-");
var now1=new Date(arr1[0],arr1[1],arr1[2],arr1[3],arr1[4],arr1[5]);
var now=new Date();
var h,m,s,dif;
now.setMonth(now.getMonth()+1);
dif= now1.getTime()-now.getTime();
h = dif / (60 * 60 * 1000);
m = (dif % (60 * 60 * 1000))/(60 * 1000);
s = ((dif % (60 * 60 * 1000))%(60 * 1000))/1000;
if(dif>0)
{
document.getElementById("sheng1").innerHTML="剩余<span> "+ parseInt(h) + " </span> 小时 <span>" + parseInt(m) + " </span> 分 <span>" + parseInt(s) +" </span> 秒";
setTimeout("timem1()", 1000);
}
else
{
document.getElementById("sheng1").innerHTML="剩余<span> 0 </span> 小时 <span>0 </span> 分 <span>0 </span> 秒";
}
}
//-->
</SCRIPT>
<script language="javascript">timem1();</script>
</body>
</html>