显示时间的方法
来源:动视网
责编:小采
时间:2020-11-27 20:12:16
显示时间的方法
显示时间的方法:<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>获取当前时间</title> <script type="text/javascript"> function
导读显示时间的方法:<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>获取当前时间</title> <script type="text/javascript"> function

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>获取当前时间</title>
<script type="text/javascript"> function getDate() {
var currentTime=new Date().getHours()+":"+new Date().getMinutes()+":"+new Date().getSeconds();
var span=document.getElementById("timeSpan");
span.innerHTML=currentTime;
window.setTimeout(getDate,1000); }
</script>
</head>
body>
<input type="button" id="" value="获取当前时间" onclick="getDate()"/>
<span id="timeSpan"></span>
</body>
</html>
显示时间的方法
显示时间的方法:<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>获取当前时间</title> <script type="text/javascript"> function