正在加载...

网上有很多的js ,ie下能正常显示,但在firefox下的 年老是有问题,现在  终于找到了在 ie firefox 下都正常的当前时间显示,贴出来备用,也希望对你有用.......代码如下:

<DIV id=time>当前时间
<SCRIPT>document.getElementById('time').innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());setInterval("document.getElementById('time').innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());",1000);</SCRIPT>
</DIV>
自己在合适位置放上,也可以加上自己的样式........

您可能也对这些文章感兴趣

: http://www.quickshare.com.cn/%e7%bb%88%e4%ba%8e%e6%89%be%e5%88%b0%e4%ba%86%e5%9c%a8-ie-firefox-%e4%b8%8b%e9%83%bd%e6%ad%a3%e5%b8%b8%e7%9a%84%e5%bd%93%e5%89%8d%e6%97%b6%e9%97%b4%e6%98%be%e7%a4%ba

本文相关评论 - 才 2 条评论
游客
2008-01-02 10:40:04

如果我只需要取 时:分:秒 呢? 又该如何显示?

嘟嘟鱼
2008-01-02 23:34:17

<body onload=startclock()>

<form name="clock">
<script language="JavaScript">
var timerID = null;
var timerRunning = false;
function stopclock (){
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;}
function startclock () {
stopclock();
showtime();}
function showtime () {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds()
var timeValue = ''
timeValue += ((hours >12) ? hours -12 :hours)
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
document.clock.thetime.value = timeValue;
timerID = setTimeout("showtime()",1000);
timerRunning = true;}
</script>
<input name="thetime" style="font-size: 9pt;color:#000000;border:1px solid #FFFFFF; ; " size="28"></form>

</body>