我希望根据日期(季节)加载不同的 css 文件。
我尝试在 stackoverflow 上从此处修改图像脚本,但这不起作用。
谁能指出我哪里出错了?
<link href="/css_season/default.css" rel="stylesheet" type="text/css" onload="logo(this)">
function logo(link) {
var d = new Date();
var Today = d.getDate();
var Month = d.getMonth();
var src;
if (Month === 4 && (Today >= 1 && Today <= 30)) {
src = "/css_season/easter.css";
} else if (Month === 7 && (Today >= 1 && Today <= 31)) {
src = "/css_season/vacation.css";
} else if ((Month === 8 && Today >= 30) || (Month === 0 && Today <= 2)) {
src = "/css_season/vacation.css";
} else if (Month === 12 && (Today >= 15 && Today <= 31)) {
src = "/css_season/holidays.css";
}
link.href=href;
}