第一步:打开主题包下的header.html,修改如下代码:
将“星期”和“月份”的英文修改为中文,如下:
第二步:接下来修改上面这段代码往下的这几行:
将其修改为:
第三步:将header.html文件保存为 UTF-8编码格式
刷新页面,修改后的效果如下:
附代码:
1、源代码
// Get today's current date.
var now = new Date();
// Array list of days.
var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
// Array list of months.
var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
// Calculate the number of the current day in the week.
var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
// Calculate four digit year.
function fourdigits(number)
{
return (number < 1000) ? number + 1900 : number;
}
// Join it all together
today = days[now.getDay()] + " " +
date + " " +
months[now.getMonth()] + " " +
(fourdigits(now.getYear())) ;
// Print out the data.
document.write("" +today+ " ");
2、修改后的代码
// Get today's current date.
var now = new Date();
// Array list of days.
var days = new Array('星期天','星期一','星期二','星期三','星期四','星期五','星期六');
// Array list of months.
var months = new Array('一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月');
// Calculate the number of the current day in the week.
var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
// Calculate four digit year.
function fourdigits(number)
{
return (number < 1000) ? number + 1900 : number;
}
// Join it all together
today = (fourdigits(now.getYear())) + "年" +
months[now.getMonth()] +
date + "日" + " " +
days[now.getDay()] ;
// Print out the data.
document.write("" +today+ " ");