有时这段代码可以正常工作,但这取决于我将要执行的部分放在哪里,这实际上是说它根本不起作用——但我真的不知道为什么不。也许你们中的任何一个人都可以提供一些见解:
function displayBanner(currentDate) {
var munf = currentDate.getMonth();
var imageSrc = "defaultLogo.gif";
imageSrc = (munf == 9) ? ("fallLogo.gif") : ("defaultLogo.gif");
imageSrc = (munf == 8) ? ("fallLogo.gif") : ("defaultLogo.gif");
imageSrc = (munf == 10) ? ("fallLogo.gif") : ("defaultLogo.gif");
imageSrc = (munf == 11) ? ("winterLogo.gif") : ("defaultLogo.gif");
imageSrc = (munf == 0) ? ("winterLogo.gif") : ("defaultLogo.gif");
imageSrc = (munf == 1) ? ("winterLogo.gif") : ("defaultLogo.gif");
imageSrc = (munf == 2) ? ("springLogo.gif") : ("defaultLogo.gif");
imageSrc = (munf == 3) ? ("springLogo.gif") : ("defaultLogo.gif");
imageSrc = (munf == 4) ? ("springLogo.gif") : ("defaultLogo.gif");
imageSrc = (munf == 7) ? ("summerLogo.gif") : ("defaultLogo.gif");
imageSrc = (munf == 5) ? ("summerLogo.gif") : ("defaultLogo.gif");
imageSrc = (munf == 6) ? ("summerLogo.gif") : ("defaultLogo.gif");
return imageSrc;
}