行业动态
JS一周值表(分上下午)
发布日期:2011-04-06 阅读次数:3495 字体大小:
<script type=text/javascript>
function jinrizhiban(){
//把需要排班的姓名按照排班顺序写在下面一行里面就可以
var pers=new Array('<font color=ff0000>上午值班:</font>徐峻&nbsp;&nbsp;张解忠','<font color=ff0000>下午值班:</font>吴志兵','<font color=ff0000>值班:</font>查敦传&nbsp;徐峻&nbsp;吴志兵&nbsp;许刚','<font color=ff0000>下午值班:</font>张解忠&nbsp;许刚','<font color=ff0000>上午值班:</font>徐峻&nbsp;&nbsp;许刚','<font color=ff0000>下午值班:</font>吴志兵&nbsp;&nbsp;许刚','<font color=ff0000>上午值班:</font>徐峻&nbsp;&nbsp;许刚','<font color=ff0000>下午值班:</font>张解忠&nbsp;&nbsp;许刚','<font color=ff0000>上午值班:</font>吴志兵&nbsp;徐峻&nbsp;许刚','<font color=ff0000>下午值班:</font>徐峻&nbsp;&nbsp;许刚','<font color=ff0000>上午值班:</font>吴志兵&nbsp;&nbsp;许刚','<font color=ff0000>下午值班:</font>徐峻&nbsp;&nbsp;许刚','<font color=ff0000>上午值班:</font>吴志兵&nbsp;徐峻&nbsp;许刚','<font color=ff0000>下午值班:</font>许刚');
//调整下面的调整因子,能控制启用程序的那天由谁值班,以后都能自动更新显示
var ctrl_param=6;
var now=new Date();
var days=parseInt(now.getTime()/12/3600/1000);
return pers[(days+ctrl_param) % pers.length];
}
document.write(jinrizhiban());
</script>

如果不想区分上下午,需将var days=parseInt(now.getTime()/12/3600/1000); 中的12改成24,然后在var pers=new Array中将数组由现在的14个(一天两个)改成7个(一天一个)