案例:javascript案例     状态:可编辑再运行    进入横版
x
 
1
<!DOCTYPE html>
2
<html>
3
<body>
4
5
<p>点击下面的按钮来显示今天是周几:</p>
6
7
<button onclick="myFunction()">点击这里</button>
8
9
<p id="demo"></p>
10
11
<script>
12
function myFunction()
13
{
14
var x;
15
var d=new Date().getDay();
16
switch (d)
17
  {
18
  case 0:
19
    x="Today it's Sunday";
20
    break;
21
  case 1:
22
    x="Today it's Monday";
23
    break;
24
  case 2:

 运行结果 
 北美留学生论坛