+ 2
Where's the mistake?
2 Respuestas
+ 3
here...
window.onload = function(){
alert("solve pls");
var month = new Date();
var now = month.getMonth()
switch(now){
case 0:
now = "January";
break ;
case 1:
now = "February";
break ;
case 2:
now = "March";
break ;
case 3:
now = "April";
break ;
case 4:
now = "May";
break ;
case 5:
now = "June";
break ;
case 6:
now = "July";
break ;
case 7:
now = "August";
break ;
case 8:
now = "September";
break ;
case 9:
now = "October";
break ;
case 10:
now = "November";
break ;
case 11:
now = "December";
}
document.write(now)
}
+ 1
It works when it's december
UPDATE: Just ran it. It also appears that document.body is null at the time when the js is executed. So either that document.body.innerhtml = must be replaced with something like document.write(), or the code should be placed in a function that is executed after the document is loaded.