Created
December 25, 2014 22:57
-
-
Save egoist/d8efd0aa50220d02cc54 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getTitle(weekday){ | |
var t = new Date(); | |
t = t.getDay(); | |
var title = ''; | |
switch(weekday){ | |
case 1: | |
title = '周一'; | |
break; | |
case 2: | |
title = '周二'; | |
break; | |
case 3: | |
title = '周三'; | |
break; | |
case 4: | |
title = '周四'; | |
break; | |
case 5: | |
title = '周五'; | |
break; | |
case 6: | |
title = '周六'; | |
break; | |
case 7: | |
title = '周日'; | |
break; | |
} | |
if(weekday = t) title += '<small>今天</small>'; | |
if(weekday = t-1) title += '<small>昨天</small>'; | |
if(weekday = t-2) title += '<small>前天</small>'; | |
if(weekday = t+1) title += '<small>明天</small>'; | |
if(weekday = t+2) title += '<small>后天</small>'; | |
return title; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment