日期:2014-05-16  浏览次数:20311 次

根据某年某月某日获得这一天是星期几之js篇
<html>
	<head>
		<title></title>
	
		<script type="text/javascript">
			  function toDate(uYear, uMonth, uDay) {
				var arr = "日一二三四五六".split("");
				with(document.all) {
					var vYear = parseInt(uYear, 10);
					var vMonth = parseInt(uMonth, 10);		
					var vDay = parseInt(uDay, 10);
				}
				var date = "星期"+arr[new Date(vYear,vMonth-1,vDay).getDay()];

				alert(date);

				return  date;
			  }

			window.onload = function() {
				var dateStr = "2010-07-01";
				var arr = dateStr.split("-");
				toDate(arr[0], arr[1], arr[2]);
			}
			  
		</script>
	</head>

	<body>
		
	</body>
</html>