89、时间相互对比

89、时间相互对比

重云傍苧:

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

<!--By:  Rakesh Jain (rakeshjain@iname.com) -->

<!-- Web Site:  http://www.bhabus.com -->

 

function displaydatetime() {

if (!document.layers && !document.all)      return;

  var today;

  var timeLocal;

  var timeUTC;

  today = new Date();

  timeLocal = today.toLocaleString() + " " + "Local"; //Convert to current locale.

  timeUTC = today.toUTCString(); //Convert to UTC.

  if (document.layers) {

    document.layers.clockLocal.document.write(timeLocal);

    document.layers.clockLocal.document.close();

    document.layers.clockUTC.document.write(timeUTC);

    document.layers.clockUTC.document.close();}

  else if (document.all) {

  clockLocal.innerHTML = timeLocal;

  clockUTC.innerHTML = timeUTC;}

  setTimeout("displaydatetime()", 500)

}

  window.onload = displaydatetime;

//  End -->

</script>

<span id=clockLocal style="position:relative;"></span><br>

<span id=clockUTC style="position:relative;"></span>

 

Write a comment

Comments: 0