日期:2014-05-16 浏览次数:20381 次
<mce:script language="JavaScript"><!-- //定义一个tick函数,以获取系统的时间 function tick() { var year,month,day,hours,minutes,seconds,ap; var intYear,intMonth,intDay,intHours,intMinutes,intSeconds; var today; today=new Date(); intYear=today.getYear()+1900; intMonth=today.getMonth()+1; intDay=today.getDate(); intHours=today.getHours(); intMinutes=today.getMinutes(); intSeconds=today.getSeconds(); //获取系统时间的小时数 if(intHours==0) { hours=intHours+":"; ap="凌晨"; } else if(intHours<12) { hours=intHours+":"; ap="早晨"; } else if(intHours==12) { hours=intHours+":"; ap="中午"; } else { intHours=intHours-12; hours=intHours+":"; ap="下午"; } //获取系统时间的分数 if(intMinutes<10) { minutes="0"+intMinutes+":"; } else { minutes=intMinutes+":"; } //获取系统时间的秒数 if(intSeconds<10) { seconds="0"+intSeconds+" "; } else { seconds=intSeconds+" "; } timeString=intYear+'年'+intMonth+'月'+intDay+'日'+hours+minutes+seconds+ap; document.getElementById("Clock").innerHTML=timeString; //每隔0.1秒钟执行一次tick函数 window.setTimeout("tick()",100); } window.onload=tick; //document.getElementById("Clock").innerHTML=timeString; // --></mce:script> body中的div为:<div id="Clock"></div>
------解决方案--------------------
楼上的这些都是获得客户端的时间吧!!
假如客户端的时间一改,那面页面上显示的也就是改之后的时间了
楼主看看下面的链接
http://www.code-123.com/html/2009727175322580.html
------解决方案--------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <SCRIPT LANGUAGE="JavaScript"> <!-- function showtime() { var now = new Date(); var year =