87,993
社区成员
发帖
与我相关
我的任务
分享<ul>
<li><a href='/archives/1059689.html'>2007/04/01 - 2007/04/30</a></li>
<li><a href='/archives/1056377.html'>2007/05/01 - 2007/05/31</a></li>
<li><a href='/archives/1059688.html'>2007/06/01 - 2007/06/30</a></li>
<li><a href='/archives/1065036.html'>2007/07/01 - 2007/07/31</a></li>
<li><a href='/archives/1074669.html'>2007/08/01 - 2007/08/31</a></li>
<li><a href='/archives/1082390.html'>2007/09/01 - 2007/09/30</a></li>
</ul><ul>
<li><a href='/archives/1059689.html'>2007/04/01 - 2007/04/30</a></li>
<li><a href='/archives/1056377.html'>2007/05/01 - 2007/05/31</a></li>
<li><a href='/archives/1059688.html'>2007/06/01 - 2007/06/30</a></li>
<li><a href='/archives/1065036.html'>2007/07/01 - 2007/07/31</a></li>
<li><a href='/archives/1074669.html'>2007/08/01 - 2007/08/31</a></li>
<li><a href='/archives/1082390.html'>2007/09/01 - 2007/09/30</a></li>
</ul>
<script>
var m = ['Janu', 'Febr', 'March','Apri','Mary','June','July','Augu','Sept','October','Nove','Dece'];
var ul = document.getElementsByTagName('ul')[0];
var reg = /(\d+)\/(\d+)\/\d+\s*\-\s*(\d+)\/(\d+)\/\d+(?=<\/a>)/gi;
var str = ul.innerHTML.replace(reg,'$2 $1 - $4 $3');
str = str.replace(/\d{1,2}(?=\D\d{4})/g, function(n){return m[parseInt(n)];})
ul.innerHTML = str;
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>test</title>
</head>
<script>
Date.prototype.format = function(){
var newMonth = null;
switch(this.getMonth()){
case 0:newMonth = "January";break;
case 1:newMonth = "February";break;
case 2:newMonth = "March";break;
case 3:newMonth = "April";break;
case 4:newMonth = "May";break;
case 5:newMonth = "June";break;
case 6:newMonth = "July";break;
case 7:newMonth = "August";break;
case 8:newMonth = "September";break;
case 9:newMonth = "October";break;
case 10:newMonth = "November";break;
case 11:newMonth = "December";break;
}
return newMonth + " " + this.getYear();
}
function init(){
var array = document.getElementsByTagName("li");
var reg = /(\d{4}\/\d{2}\/\d{2}) - (\d{4}\/\d{2}\/\d{2})/;
for(var i = 0;(e = array[i]); i++){
var matcher = reg.exec(e.innerHTML);
var fDate = new Date(matcher[1]);
var lDate = new Date(matcher[2]);
e.innerHTML = e.innerHTML.replace(reg,fDate.format() + " - " + lDate.format())
}
}
</script>
<body onload="init()">
<ul>
<li><a href='/archives/1059689.html'>2007/04/01 - 2007/04/30</a></li>
<li><a href='/archives/1056377.html'>2007/05/01 - 2007/05/31</a></li>
<li><a href='/archives/1059688.html'>2007/06/01 - 2007/06/30</a></li>
<li><a href='/archives/1065036.html'>2007/07/01 - 2007/07/31</a></li>
<li><a href='/archives/1074669.html'>2007/08/01 - 2007/08/31</a></li>
<li><a href='/archives/1082390.html'>2007/09/01 - 2007/09/30</a></li>
</ul>
</body>
</html>