Created
November 25, 2016 08:42
-
-
Save camark/e96863b51f414187ab8204a0dec2e026 to your computer and use it in GitHub Desktop.
考勤表
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Bootstrap</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<!-- 引入 Bootstrap --> | |
<link href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"> | |
<!-- HTML5 Shim 和 Respond.js 用于让 IE8 支持 HTML5元素和媒体查询 --> | |
<!-- 注意: 如果通过 file:// 引入 Respond.js 文件,则该文件无法起效果 --> | |
<!--[if lt IE 9]> | |
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> | |
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> | |
<![endif]--> | |
</head> | |
<body> | |
<script> | |
function getDays(t_year,t_month){ | |
var count=0 | |
switch(t_month){ | |
case 1: | |
case 3: | |
case 5: | |
case 7: | |
case 8: | |
case 10: | |
case 12: | |
count=31; | |
break; | |
case 4: | |
case 6: | |
case 9: | |
case 11: | |
count=30; | |
break; | |
case 2: | |
if(t_year%4==0) | |
count=29; | |
else | |
count=28; | |
if((t_year%100==0)&(t_year%400!=0)) | |
count=28; | |
} | |
return count; | |
} | |
function getXingqi(day){ | |
var xingqi=["日","一","二","三","四","五","六"]; | |
if(day>=0 && day<=6) | |
return xingqi[day]; | |
else | |
return ""; | |
} | |
var now = new Date(); | |
var day = now.getDay(); | |
var month = now.getMonth()+1; | |
var year = now.getYear(); | |
var days = getDays(year,month); | |
var xingqis=[] | |
var v_days=[] | |
for(var i=1;i<=days;i++){ | |
v_day=new Date(year,month,i).getDay() | |
xingqis.push(getXingqi(v_day)); | |
v_days.push(i); | |
} | |
function InsertArrayToRow(row_name,array_1){ | |
var v_row=document.getElementById(row_name); | |
for(var i=0;i<array_1.length;i++) | |
{ | |
//var cell1=v_row.insertCell(-1); | |
var cell1 = document.createElement("td"); | |
cell1.innerHTML="<td>"+array_1[i]+"</td>"; | |
v_row.appendChild(cell1); | |
} | |
} | |
window.onload = function(){ | |
InsertArrayToRow("xingqi_row",xingqis); | |
InsertArrayToRow("days_row",v_days); | |
} | |
</script> | |
<H1 align=center>考勤表</h1> | |
<table class="table"> | |
<tr id="xingqi_row"> | |
<td rowspan=2>序号</td> | |
<td rowspan=2>姓名</td> | |
<td>星期</td> | |
</tr> | |
<tr id="days_row"> | |
<td>时间</td> | |
</tr> | |
<tr id="man_row"> | |
<td rowspan=2>1</td> | |
<td rowspan=2>gm</td> | |
<td>上午</td> | |
</tr> | |
<tr id="Afternoon_row"> | |
<td>下午</td> | |
</tr> | |
</table> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment