<script type="text/javascript">
function show()
{ var time=new Date()
var year=time.getYear()
var month=time.getMonth()+1
var day=time.getDate()
var hours=time.getHours()
var minute=time.getMinutes()
var sconds=time.getSeconds()var ss=""
var mi=nullvar sc=null
if(hours>=0&&hours<12) { ss="上午好!"}
else if(hours>=12&&hours<24) { ss="下午好!"}
if(minute<10){ mi="0"+minute}
else{ mi=minute}
if(sconds<10){ sc="0"+sconds}
else{ sc=sconds}
var st="今天日期:<font size='2' style='color:red
'>"+year+"年"+month+"月"+day+"日</font>"+ " "+"现在时间:<font size='2' style='color:red
'>"+ hours+":"+mi+":"+sc+"</font>"document.getElementById("aaa").innerHTML=ssdocument.getElementById("mydate").innerHTML=stwindow.setTimeout("show()",1000) } </script>
用WdatePicker 控件就可以
1.导入js文件
<script language="javascript" type="text/javascript" src="../js/datepicker/WdatePicker.js"> </script>
2.在文本框中使用即可
<input type="text" id="temp" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})"/>用Javascript就可以实现: <script type="text/javascript">function show() { var time=new Date()var year=time.getYear()var month=time.getMonth()+1var day=time.getDate()var hours=time.getHours()var minute=time.getMinutes()var sconds=time.getSeconds()var ss=""var mi=nullvar sc=nullif(hours>=0&&hours<12) { ss="上午好!"}else if(hours>=12&&hours<24) { ss="下午好!"} if(minute<10){ mi="0"+minute}else{ mi=minute} if(sconds<10){ sc="0"+sconds}else{ sc=sconds} var st="今天日期:<font size='2' style='color:red'>"+year+"年"+month+"月"+day+"日</font>"+ " "+"现在时间:<font size='2' style='color:red'>"+ hours+":"+mi+":"+sc+"</font>"document.getElementById("aaa").innerHTML=ssdocument.getElementById("mydate").innerHTML=stwindow.setTimeout("show()",1000) } </script>欢迎分享,转载请注明来源:内存溢出
评论列表(0条)