📄 time.js
字号:
// create a new Date object
var now = new Date();
// extract the time information
var hh = now.getHours();
var mn = now.getMinutes();
var ss = now.getSeconds();
var ms = now.getMilliseconds();
// default welcome message
var hi = "Good Morning";
// welcome if after noon
if( hh > 11 ) hi= "Good Afternoon";
// welcome if after 5 p.m.
if( hh > 17 ) hi= "Good Evening";
//hi+="\nWelcome to the Acme website";
// display welcome message and the current time
var tim = hi + "\n";
tim += "Hours: " +hh+ "\n";
tim += "Minutes: " +mn+ "\n";
tim += "Seconds: " +ss+ "." +ms;
alert(tim);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -