使用Javascript每分钟更新HTML内容

时间:2016-04-29 05:57:41

标签: javascript jquery html updating

我正在编写一个脚本来更新我的html内容,我已经设置每天更新一次,但现在需要将其更改为每分钟更新一次。这是我到目前为止所提出的,请忽略它并非全部完整的事实。

//get date

Date.prototype.getDOY = function() {
    var onejan = new Date(this.getFullYear(),0,1);
    return Math.ceil((this - onejan) / 86400000);
} 

// make new date
var today = new Date();
var DOY = today.getDOY(); 

var HL=new Array();

//Configure the following array to hold the 365 HLs for each day of the year

HL[1]='HL 1 goes here';
HL[2]='HL 2 goes here';
HL[3]='HL 3 goes here';
HL[4]='HL 3 goes here';
HL[5]='HL 3 goes here';
HL[6]='HL 3 goes here';
HL[7]='HL 3 goes here';
HL[8]='HL 3 goes here';
HL[9]='HL 3 goes here';
HL[10]='HL 3 goes here';
HL[11]='HL 3 goes here';
HL[12]='HL 3 goes here';
HL[13]='HL 3 goes here';
HL[14]='HL 3 goes here';
HL[15]='HL 3 goes here';
HL[16]='HL 3 goes here';
HL[17]='HL 3 goes here';
HL[18]='HL 3 goes here';
HL[19]='HL 3 goes here';
HL[20]='HL 3 goes here';
HL[21]='HL 3 goes here';
HL[22]='HL 3 goes here';
HL[23]='HL 3 goes here';
HL[24]='HL 3 goes here';
HL[25]='HL 3 goes here';
HL[26]='HL 3 goes here';
HL[27]='HL 3 goes here';
HL[28]='HL 3 goes here';
HL[29]='HL 3 goes here';
HL[30]='HL 3 goes here';
HL[31]='HL 3 goes here';
HL[32]='HL 3 goes here';

//... for the sake of time, skip to last day of year:

HL[365]='HL 3 goes here';

document.write(HL[DOY]);

0 个答案:

没有答案