熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

時鐘顯示在任意指定位置

2022-06-13   來源: JSP教程 

  腳本說明

:把如下代碼加入區域中:
  <span id=liveclock style=position:absolute;left:px;top:px;; width: px; height: px>
</span>    (這裡可以調整時鐘的方位調用腳本時去掉括號中內容)
<SCRIPT language=javascript>
<!

  function show(){if(!documentlayers&&!documentall)
return
var Digital=new Date()
var hours=DigitalgetHours()
var minutes=DigitalgetMinutes()
var seconds=DigitalgetSeconds()
var dn=AM
if(hours>){dn=PM
hours=hours
}if(hours==)
hours=
if(minutes<=)
minutes=+minutes
if(seconds<=)
seconds=+seconds
//change font size here to your desire
myclock=<font size= face=Arial><b><font size=>Current Time:</font></br>+hours+:+minutes+:
+seconds+ +dn+</b></font>
if(documentlayers){documentlayersliveclockdocumentwrite(myclock)
documentlayersliveclockdocumentclose()
}else if(documentall)
liveclockinnerHTML=myclock
setTimeout(show())
}
//>
</SCRIPT>


From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19667.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.