46. time.js
setInterval
(
'timeoutput()',1000
);
function
timeoutput(){
now
=
new
Date()
;
h
=
now.getHours();
mi
=
now.getMinutes();
s
=
now.getSeconds();
document.getElementById("content").innerHTML
=
"<span
id="+
"time"
+">"
+
h
+
":"
+
mi
+
":"
+
s
+"</
span>";
}
47. time.js
コード 日本語訳
何ミリ秒おきに仕事するか
setInterval
(
'timeoutput()',1000
);
(
'timeoutput()',1000
);
function
timeoutput(){
now
=
new
Date()
; 仕事
timeoutput(){
h
=
now.getHours();
now
に
新しく今の時間情報を追加
;
mi
=
now.getMinutes();
h
に今の時間数を追加;
s
=
now.getSeconds();
mi
に今の分数を追加;
document.getElementById("content")
s
に今の秒数を追加;
.innerHTML
=
"<span
id="+
"time"
+">"
"content"に埋め込みます
=
+
h
+
":"
+
mi
+
":"
+
s
+ "<span>要素に時間と分と秒を表示するよ";
"</span>";
} }