中文(繁体)
<!--要完成此效果需要兩個步驟第一步:把以下程式碼加入<head>區域中--> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function formatDate(date) { var mymonth = date.getMonth()+1; var myweekday = date.getDate(); return (mymonth + "月" + myweekday+ "日"); } function printWeek() { var now = new Date(); var nowDayOfWeek = now .getDay(); var nowDay = now.getDate(); var nowMonth = now.getMonth(); var nowYear = now.getYear(); nowYear += (nowYear < 2000) ? 1900 : 0; var wateStartDate = new Dster (nowYear, nowMonth, nowDay - nowDayOfWeek); var weekEndDate = new Date(nowYear, nowMonth, nowDay + (6 - nowDayOfWeek)); document.write("當前星期: " + formatDate(weekStart forDate)); weekEndDate)); } // End --> </script> <!--第二步:把如下程式碼加入<body>區域--> <script> printWeek(); </script>