星期的显示
<head> <meta charset="UTF-8"> <title></title> <script> window.onload = function(){ showTime(); } function showTime(){ var mydate = new Date(); var year = mydate.getFullYear(); var month = mydate.getMonth()+1; var date = mydate.getDate(); var d = mydate.getDay(); var weekdays[] = new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六"); alert(weekdays[0]); document.getElementById('myshow').innerHTML = year+"年"+month+"月"+date+"日"+weekdays[d] } </script> </head> <body> <div id="myshow"></div> </body>
为什么星期的数组加上之后,就什么都不显示了,alert语句也不输出了,看不出啥问题啊~有大神指导么?