$(function(){ var dateTarget = $("#cur_date"); var curDate = new Date(); getCurDay(dateTarget); function getCurDay(textTarget){ $(textTarget).text("今天是:" + curDate.getFullYear() + "年" + toDouble(parseInt(curDate.getMonth() + 1)) + "月" + toDouble(parseInt(curDate.getDate())) + "日"); } function toDouble(obj){ if(obj < 10){ return "0" + obj; }else{ return obj; } } });