js实现的单位轮流值班轮换表
<script language="javascript"> var src="张三,李四,王五,赵六,钱七,孙八,曾久" var srcArray=src.split(",") var beginDate=new Date(2012,7,7) var nowdate=new Date() var diff=Math.floor((nowdate-beginDate)/(86400000*7)) diff=diff%srcArray.length var nextDiff=(diff+parseInt(1))%srcArray.length var nowWeek=srcArray[diff] var nextWeek=srcArray[nextDiff] alert("本周值班:"+nowWeek+";下周值班:"+nextWeek) </script>