// passage time var pass = 23; // display content var content = ' 24時間以内'; var currentDate = new Date(); var span_2 = document.getElementsByTagName('span'); for (i = 0; i < span_2.length; i++) { if (span_2[i].getAttribute('class') == 'new_days' || span_2[i].getAttribute('className') == 'new_days') { if (span_2[i].childNodes[0]) { time = span_2[i].childNodes[0].nodeValue.split(":"); var entryDate = new Date(time[0], time[1]-1, time[2], time[3], time[4], time[5]); var now = (entryDate.getTime() - currentDate.getTime())/(60*60*1000); now = Math.ceil(now); if(-now <= pass){ span_2[i].innerHTML = content; span_2[i].style.display = 'inline'; } } } }