-
Notifications
You must be signed in to change notification settings - Fork 0
/
MY6.3.2.html
42 lines (40 loc) · 1.35 KB
/
MY6.3.2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script>
/* function func(){
return Math.floor(Math.random()*101);
};
document.write(func());*/
var weekday;
weekday = prompt("请输入一个表示今天是星期几的数字(0:星期日;1: 星期一;…;6:星期六):","0"); //这么输入的类型就是string类型
console.log(typeof weekday); //经检验 weekday是个string类型的 规定啊
weekday=parseInt(weekday)
switch(weekday)
{
case 0: alert("今天是星期日");break;
case 1: alert("今天是星期一");break;
case 2: alert("今天是星期二");break;
case 3: alert("今天是星期三");break;
case 4: alert("今天是星期四");break;
case 5: alert("今天是星期五");break;
case 6: alert("今天是星期六");break;
default:
alert("输入有误");break;
}
var now = new Date(),s; //这个是new了啥? 就是new了当前的日期拉
s = now.getFullYear()+"年"+
now.getMonth()+"月"+
now.getDate()+"日"+
now.getHours()+"点"+
now.getMinutes()+"分"+
now.getSeconds()+"秒"+
"(星期"+now.getDay()+")";
document.write("现在是"+s+",欢乐您的到访!");
</script>
</body>
</html>