标签:blog io ar java div on log cti html
<?php
header("content-type:text/html;charset=utf-8");
//如果不是UTF-8编码请删除上面这句.
date_default_timezone_set("PRC");
echo ‘<div id="time"></div>
<script type="text/javascript">
function $(o){
return document.getElementById(o);
}
var ts=‘.(round(microtime(true)*1000)).‘;
function getTime(){
var t=new Date(ts);
with(t){
var _time="现在是:"+getFullYear()+"-" + (getMonth()+1)+"-"+getDate()+" " + (getHours()<10 ? "0" :"") + getHours() + ":" + (getMinutes()<10 ? "0" :"") + getMinutes() + ":" + (getSeconds()<10 ? "0" :"") + getSeconds();
}
$("time").innerHTML=_time;
setTimeout("getTime()",1000);
ts+=1000;
}
getTime();
</script>‘;
?>
存为time.php
<IFRAME border=0 marginWidth=0 marginHeight=0 src="/time.php" frameBorder=no scrolling=no width="400" height="100%"></IFRAME>
在html页面显示出来。
标签:blog io ar java div on log cti html
原文地址:http://www.cnblogs.com/smy520/p/4059702.html