js实现动态获取系统时间,并动态显示在网页上的效果
function showtimes(){ //获取当前日期 var date_time = new Date(); //定义星期 var week; //switch判断 switch (date_time.getDay()){ case 1: week="星期一"; break; case 2: week="星期二"; break; case 3: week="星期三"; break; case 4: week="星期四"; break; case 5: week="星期五"; break; case 6: week="星期六"; break; default:week="星期天"; break; } //年 var year = date_time.getFullYear(); //判断小于10,前面补0 if(year