<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script language="javascript" type="text/javascript"> 
function haha1() 

var now = new Date(); //获取系统日期,即Sun Apr 29 16:41:48 UTC+0800 2007 
var yy = now.getYear(); //获取年,即2007 
var mm = now.getMonth() + 1; //获取月,即04 
var dd = now.getDay(); //获取该天的星期值 
//获取时间 
var hh = now.getHours(); //获取小时,即16 
var mm = now.getMinutes(); //获取分钟,即41 
var ss = now.getTime() % 60000; //获取时间,因为系统中时间是以毫秒计算的, 
//所以秒要通过余60000得到。 
ss = (ss - (ss % 1000)) / 1000; //然后,将得到的毫秒数再处理成秒 
var clock = hh+':'; //将得到的各个部分连接成一个日期时间 
if (mm < 10) clock += '0'; //字符串 
clock += mm+':'; 
if (ss < 10) clock += '0'; 
clock += ss; 
document.all.testclock.value = clock; 

</script> 
<input type="text" name="testclock" > <script language="javascript" type="text/javascript"> 
haha1();
</script> 
</html> 如果点击个按钮的话跳出当前时间下面的是可以的: 
<html> 
<script language="javascript" type="text/javascript"> 
function haha2() 

var now = new Date(); //获取系统日期,即Sun Apr 29 16:41:48 UTC+0800 2007 
var yy = now.getYear(); //获取年,即2007 
var mm = now.getMonth() + 1; //获取月,即04 
var dd = now.getDay(); //获取该天的星期值 
//获取时间 
var hh = now.getHours(); //获取小时,即16 
var mm = now.getMinutes(); //获取分钟,即41 
var ss = now.getTime() % 60000; //获取时间,因为系统中时间是以毫秒计算的, 
//所以秒要通过余60000得到。 
ss = (ss - (ss % 1000)) / 1000; //然后,将得到的毫秒数再处理成秒 
var clock = hh+':'; //将得到的各个部分连接成一个日期时间 
if (mm < 10) clock += '0'; //字符串 
clock += mm+':'; 
if (ss < 10) clock += '0'; 
clock += ss; 
window.document.write(clock); 

</script> 
<input type="button" name="testclock" onclick="javascript:haha2();"><script language="javascript" type="text/javascript"> 
</script> 
</html>