标签:
<!DOCTYPE html>
<html>
<meta http-equiv="Content-Type" content="text/html charset=utf-8"/>
<head>
<title></title>
</head>
<p id = "demo"></p>
<p id = "Angel"></p>
<p>switch 语句判断当前是星期几</p>
<button onclick="myFunction()">试一试</button>
<body>
<script type="text/javascript">
function myFunction()
{
var day = new Date().getDay();
switch(day)
{
case 0 :
x = "Today is Sunday";
break;
case 1 :
x = "Today is Monday";
break;
case 2 :
x = "Today is Tuesday";
break;
case 3 :
x = "Today is Wednesday";
break;
case 4 :
x = "Today is Thursday";
break;
case 5 :
x = "Today is Friday";
break;
case 6 :
x = "Today is Saturday";
break;
}
day = document.getElementById("demo").innerHTML=x;
Houre = new Date().getHours();
HOure_H=document.getElementById("Angel").innerHTML= Houre;
}
</script>
</body>
</html>
标签:
原文地址:http://blog.csdn.net/u012701023/article/details/46313149