<form name=meizz><input size=9 type=text name=clock
 style="border: 0px;background-color: transparent"></form>
<script language="Javascript"><!--
function timer()
{
   var now = new Date();
   var h = (now.getHours()   > 9) ? now.getHours()   : "0" + now.getHours();
   var m = (now.getMinutes() > 9) ? now.getMinutes() : "0" + now.getMinutes();
   var s = (now.getSeconds() > 9) ? now.getSeconds() : "0" + now.getSeconds();
   document.meizz.clock.value = h +":"+ m +":"+ s;
   setTimeout('timer()',1000);
}  timer();
// --></script>用这种方法应该可以在NS下运行,(我这没有NS,这段代码没有测试)

解决方案 »

  1.   

    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    </HEAD>
    <script>
    function showTime()
    {
      var d = new Date();
      document.getElementById("hour").innerHTML = d.getHours(); 
      document.getElementById("minute").innerHTML = d.getMinutes();
      document.getElementById("second").innerHTML = d.getSeconds();
    }
    </script>
    <BODY onload="setInterval('showTime()', 1000);">
    <div>
    <font id="hour">0</font>时
    <font id="minute">0</font>分
    <font id="second">0</font>秒
    </div>
    </BODY>
    </HTML>
      

  2.   

    梅花雨是对的。IE、NS通用。补充日期
    <label id=labelClock style="font-size:12px;border: 0px;background-color: transparent"></label>
    <script language="Javascript">
    function timer(){
    var now = new Date();
    var hour = (now.getHours() > 9) ? now.getHours() : "0" + now.getHours();
    var min = (now.getMinutes() > 9) ? now.getMinutes() : "0" + now.getMinutes();
    var sec = (now.getSeconds() > 9) ? now.getSeconds() : "0" + now.getSeconds();
    var year = now.getFullYear();
    var month = now.getMonth() + 1;
    var day = now.getDate();
       document.getElementById("labelClock").innerHTML = hour +":"+ min +":"+ sec;
       document.getElementById("labelClock").title = year +"年"+ month +"月"+ day +"日";
       setTimeout('timer()',1000);
    }
    timer();
    </script>