- JScript code
<html> <head> <title>JS时间累加</title> <meta http-equiv = "refresh" content = "1"> <script language="text/javascript"> function getTime() { var objdate = new Date(); var hour = objdate.getHours(); var minute = objdate.getMinutes(); var second = objdate.getSeconds(); var time = hour +":" minute +":"+second; document.write("当前时间为: "+ time); } </script> </head> <body> </body> </html>
------解决方案--------------------
------解决方案--------------------
var time = hour +":" minute +":"+second;
少了+号。。
var time = hour +":" + minute +":"+second;