代码如下:
//http://history.sturgeon.mopaas.com //主页
//http://history.sturgeon.mopaas.com/jsonp?callback=? //jsonp接口
//http://history.sturgeon.mopaas.com/jsonp //json接口
//http://history.sturgeon.mopaas.com/jsonp/1@1 //历史上的1月1日
//http://history.sturgeon.mopaas.com/1@1 //历史上的1月1日
$.getJSON('http://history.sturgeon.mopaas.com/jsonp?callback=?',function(data){
parserTodayObj(data);
});
function parserTodayObj(todayObj){
for(var key in todayObj){
if(/^.*出生.*$/.test(key)){
doBirthday(todayObj[key]);
}
if(/^.*假日.*$/.test(key)){
doHoliday(todayObj[key]);
}
if(/^.*风俗.*$/.test(key)){
doHoliday(todayObj[key]);
}
if(/^.*逝世.*$/.test(key)){
doDeath(todayObj[key]);
}
if(/^.*事记.*$/.test(key)){
doMemorabilia(todayObj[key]);
}
}
}
parserTodayObj(todayObj);
function doBirthday(birthdays){
if(birthdays.length != 0){
$(document.body).append("
"+birthdayitem+"
");function doHoliday(holidays){
if(holidays.length != 0){
$(document.body).append("
"+item+"
");function doDeath(deaths){
if(deaths.length != 0){
$(document.body).append("
"+item+"
");function doMemorabilia(memorabilias){
if(memorabilias.length != 0){
$(document.body).append("
"+item+"
"); 代码如下:
//http://history.sturgeon.mopaas.com //主页
//http://history.sturgeon.mopaas.com/jsonp?callback=? //jsonp接口
//http://history.sturgeon.mopaas.com/jsonp //json接口
//http://history.sturgeon.mopaas.com/jsonp/1@1 //历史上的1月1日
//http://history.sturgeon.mopaas.com/1@1 //历史上的1月1日
$.getJSON('http://history.sturgeon.mopaas.com/jsonp?callback=?',function(data){
parserTodayObj(data);
});
function parserTodayObj(todayObj){
for(var key in todayObj){
if(/^.*出生.*$/.test(key)){
doBirthday(todayObj[key]);
}
if(/^.*假日.*$/.test(key)){
doHoliday(todayObj[key]);
}
if(/^.*风俗.*$/.test(key)){
doHoliday(todayObj[key]);
}
if(/^.*逝世.*$/.test(key)){
doDeath(todayObj[key]);
}
if(/^.*事记.*$/.test(key)){
doMemorabilia(todayObj[key]);
}
}
}
parserTodayObj(todayObj);
function doBirthday(birthdays){
if(birthdays.length != 0){
$(document.body).append("
"+birthdayitem+"
");function doHoliday(holidays){
if(holidays.length != 0){
$(document.body).append("
"+item+"
");function doDeath(deaths){
if(deaths.length != 0){
$(document.body).append("
"+item+"
");function doMemorabilia(memorabilias){
if(memorabilias.length != 0){
$(document.body).append("
"+item+"
");声明:本网页内容旨在传播知识,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。TEL:177 7030 7066 E-MAIL:11247931@qq.com