直接放到html页面,图片地址自己更换,废话不多说,代码贴出

<img id=”alixixi” src=”https://www.timem.cn/wp-content/themes/Luju/images/banner.jpg” alt=”时光小站” />
<script>
function DateDiff(asStartDate,asEndDate){
var miStart=Date.parse(asStartDate.replace(/\-/g,’/’));
var miEnd=Date.parse(asEndDate.replace(/\-/g,’/’));
return (miEnd-miStart)/(1000*24*3600);
}

function curlogo() {
var daytime = new Date().getYear()+”-“+(new Date().getMonth()+1)+”-“+new Date().getDate();
if (DateDiff(daytime,new Date().getYear()+”-08-07″)==0) {
document.getElementById(“alixixi”).src=”https://www.timem.cn/wp-content/themes/Luju/images/liqiu.png”; //立秋
}

//其它节日请复制下面三行代码修改”-10-01″及图片路径部分代码
else if (DateDiff(daytime,new Date().getYear()+”-10-01″)==0) {
document.getElementById(“alixixi”).src=”https://www.timem.cn/wp-content/themes/Luju/images/guoqing.jpg”; //国庆节
}
//其它节日请复制上面三行代码修改”-10-01″及图片路径部分代码

}
</script>

--END--