JavaScript中关于document.write(“0”);的意思
JavaScript对象
<script>
var date= new Date();
document.write("now it's"+ date.getFullYear()+"年"+(date.getMonth()+1)+"月"+date.getDate()+"日 ");
var day = date.getDay();
switch(day){
case 0:
d = "Sunday";
break;
case 1:
d = "Monday";
break;
case 2:
d = "Tuesday";
break;
case 3:
d = "Wednesday";
break;
case 4:
d = "Thursday";
break;
case 5:
d = "Friday";
break;
default:
d = "Saturday";
}
document.write(d+" ");
if(date.getHours() |
免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。
版权声明:作者保留权利,不代表天盟立场。
|
|
|
|
意思就是如果时分秒小于10时,就显示成0+要显示的数字形式,比如15:58:03 中的“03” |
|
|
|
|