<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>一定間隔で繰り返し実行</title>
<script>
function count_time() {
var timer = document.getElementById('timer');
var date = new Date();
timer.innerHTML = date.toLocaleString();
}
window.onload = function() {
// 1秒(1000ミリ秒)ごとにcount_time関数を実行
setInterval(count_time, 1000);
}
</script>
</head>
<body>
<div id="timer"></div>
</body>
</html>
More than 3 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme