求助,在线等待!!!

wenya6210 2004-01-14 03:38:55
小弟初学ASP,正在做出勤管理系统还请多多指教。
以下功能实在是搞不定了
1,当选择年份或月份时天数会自动刷新:2004年2月29天
2005年2月28天
……
2,联动问题:当选择“无休”时“勤务时间”自动变成“00:00~00:00”
3,如何点击提交呀(点发送是想刷新个预览确定的新页面,然后再提交数据库)
<html>
<head><title> 勤怠表 </title></head>
<body bgcolor="#FFFFFF">
<form id=f>
<font size=6>       </font>
<select id=year name=year>
<% for n = 2004 to 2008 %>
<option value= "<%=n%>"> <%=n%> </option>
<%next%>
</select> 年度

<select id=month name=month onchange="return month_onchange()">
<option>请选择月份 </option>
<% for m = 1 to 12 %>
<option value="<%=m%>"> <%=m%> </option>
<%next%>
</select> 月份の勤怠表 </form>

<Script LANGUAGE=VBScript>
function month_onchange()
MySelect=document.all("year")
with MySelect
sValue=options[selectedIndex].value;
end with
year=sValue
MySelect=document.all("month")
with MySelect
sValue=options[selectedIndex].value;
end with
month=sValue
end function
</Script>

<p><font size=2>     </font>
<td class=p2 align=right> <font color=D11B00> </font> 日 </td>
<font size=2>        </font>
<td class=p2 align=right> <font color=D11B00> </font> 勤务种类 </td>
<font size=2>         </font>
<td class=p2 align=right> <font color=D11B00> </font> 勤务时间 </td>
<font size=2>          </font>
<td class=p2 align=right> <font color=D11B00> </font> 备考 </td><br></p>

<Script LANGUAGE=VBScript>
select case month
case 1,3,5,7,8,10,12
getdays=31
case 4,6,9,11
getdays=30
case 2 '判断是否为闰年
if year mod 4=0 and year mod 100>0 or year mod 400=0 then
isrn=true
else
isrn=false
end if
if isrn=true then getdays=29 else getdays=28
case else
getdays=0
end select

dim day
day = 1
Do while day <= getdays
if day < 10 then
response.write ("   0" & day)
else
response.write ("   " & day)
end if
</Script>

<font size=2>       </font>
<select onchange= " " name=kind>''''''''''''''''''''''''''
<option value=1 selected> 通常 </option>
<option value=2> 有休 </option>
<option value=3> 无休 </option>
<option value=4> 代休 </option>
<option value=5> 代休出勤 </option>
<option value=6> 祝日(祭日) </option></select>
<font size=2>   </font>

<select onchange= " " name=time>'''''''''''''''''''''''''''
<option value=" " selected> 9:00~18:00 </option>
<option value=" "> 9:30~18:30 </option>
<option value=" "> 00:00~00:00 </option>
</select><font size=2>   </font>
<input type="text" name="bikou" size="20"> <br>
<Script LANGUAGE=VBScript>
if day > 31 then
exit do
end if
day = day + 1
Loop
</Script>
<form id=g>
<p><input type="submit" value=" 发送 " name="submit">
<input type="reset" value=" 重填 " name="reset"></p>
</form>
<%
For Each i In Request.Form("time")
Response.Write i & "<BR>"
Next
%>
</body>
</html>
...全文
125 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
AppleiPod 2004-01-14
  • 打赏
  • 举报
回复
后面的没时间写了,参考“提交”吧
AppleiPod 2004-01-14
  • 打赏
  • 举报
回复
以下只需要修改即可
----test.asp----
<html>
<head><title> SALSYS 勤怠表 </title>
<script language="Javascript">
<!--
var year;
var month;
//-->
</script>
</head>
<frameset rows="53,*">
<frame src="test1.asp" name="top" scrolling="Auto">
<frame src="test2.asp" name="bottom" scrolling="Auto">
</frameset>
</html>


----test1.asp----
<%@language="vbscript" %>
<html>
<body>
<form id=f>

<select id=year name=year>
' <% for n = 2004 to 2008 %>
<option value= "<%=year(now)%>" > <%=year(now)%> </option>
' <%next%>
</select>

<select id=month name=month onchange="return month_onchange()">
<option></option>
<% for m = 1 to 12 %>
<option value="<%=m%>" > <%=m%> </option>
<%next%>
</form>

<script language=javascript>
<!--
function month_onchange() {
var MySelect = document.all("year")
with (document.all("year")) {
var sValue=options[selectedIndex].value;
}
window.parent.year=sValue;
var MySelect = document.all("month")
with (document.all("month")) {
var sValue = options[selectedIndex].value;
}
window.parent.month = sValue;
window.open('test2.asp','bottom');
}
//-->
</script>
</body>
</html>


---test2.asp---
<html>
<body>
<script language=javascript>
<!--
var year;
var month;
// Select框的改变选项事件
year=window.parent.year;
month=window.parent.month;
// if(year==null) {
// todayDate=new Date();
// today=todayDate.getYear();
// year=today;
// }
if(year!=null && month!=null) {
var result;
var maxdays;
result=year%4;
if(result==0)
if(month==2) {maxdays=29;}
else if(month==1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12)
{maxdays=31;}
else if(month==4 || month==6 || month==9 || month==11)
{maxdays=30;}
else
{maxdays=28;}

if (month!="") {
document.write("<form id=con align=center method=post action=' '>");
document.write("<p align=center> <font size=9>");
document.write(year+"年"+month+"月");
document.write("</font></p>");
document.write("<table border=1>");

for(var i=1;i<=maxdays;i++) {
document.write("<tr align=center>");
document.write("<td align=left>");
document.write(i+"日");
document.write("</td>");

document.write("<td align=center>");
document.write("<select id=out name=out>");
document.write("<option value=" + i + ">" + "勤务种类" + "</option>");
document.write("</select>");
document.write("</td");

document.write("<td align=center>");
document.write("<select id=outtime name=outtime>");
document.write("<option value=1>9:00~18:00</option>");
document.write("<option value=2>9:30~18:30</option>");
document.write("</select>");
document.write("</td>");

document.write("<td align=center>");
document.write("<input type='text' name=" + i + ">");
document.write("</td>");
document.write("</tr>");
}
document.write("</table>");
document.write("<p align=center>");
document.write("<input type='submit' name=confirm value='提交'>");
document.write("</p>");
document.write("</form>");
} else {
alert("请选择月份!");
}
}
//-->
</script>
</body>
</html>
x_gn 2004-01-14
  • 打赏
  • 举报
回复
你的代码很乱,我先看一下
wenya6210 2004-01-14
  • 打赏
  • 举报
回复
to: x_gn(X新人类)
这个例子我看过,我是想在下面显示出来,你可以看看这个,当我换年月时,最大日子要随之改变。
<html>
<head><title> 勤怠表 </title></head>
<body bgcolor="#FFFFFF">
<form id=f>
<font size=6>       </font>
<select id=year name=year onchange="vbs:chg"> </select> 年度
<select id=month name=month onchange="vbs:chg"> </select> 月份の勤怠表 </form>
<Script LANGUAGE=VBScript>
MyAdd "f.year", 2004, 2008 '初始年
MyAdd "f.month",1 , 12 '初始月
SUB MyAdd(S, x, y) '增加
set obj=eval(S)
for i=x to y
set o=document.createElement("OPTION")
o.text=i
o.value=i
obj.add o
next
end SUB
SUB MyRemove(S) '删除
set obj=eval(S)
for each opt in obj.options
obj.remove opt.index
next
end SUB
SUB chg '自定义过程,用来改变日期
Dim mydate,maxdate
for i=1 to 31
mydate=f.year.value & "-" & f.month.value & "-" & i
if isdate(mydate) then '判断是否是有效日期
maxdate=i '得到月份的天数
else
exit for
end if
next
''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''
end SUB
</Script>
<p>
<font size=2>     </font>
<td class=p2 align=right> <font color=D11B00> </font> 日 </td>
<font size=2>        </font>
<td class=p2 align=right> <font color=D11B00> </font> 勤务种类 </td>
<font size=2>         </font>
<td class=p2 align=right> <font color=D11B00> </font> 通勤时间 </td>
<font size=2>          </font>
<td class=p2 align=right> <font color=D11B00> </font> 备考 </td><br></p>
<%''''''''''''''''''''''''
y = 2004
m = 1
''''''''''''''''''''''''
select case m
case 1,3,5,7,8,10,12
getdays=31
case 4,6,9,11
getdays=30
case 2 '判断是否为闰年
if y mod 4=0 and y mod 100>0 or y mod 400=0 then
isrn=true
else
isrn=false
end if
if isrn=true then getdays=29 else getdays=28
case else
getdays=0
end select

dim day
day = 1
Do while day <= getdays ''''''''''''''''''''''''''''Do while day <= maxdate respone.write()
if day < 10 then
response.write ("   0" & day)
else
response.write ("   " & day)
end if
%>
<font size=2>       </font>
<select onchange=chg_manu(this.value,document.search_form.manuid.value) name=syurui>''''''''''''''''''''''''''
<option value=1 selected> 通常 </option>
<option value=2> 有休 </option>
<option value=3> 无休 </option>
<option value=4> 代休 </option>
<option value=5> 代休出勤 </option>
<option value=6> 祝日(祭日) </option>
</select><font size=2>   </font>

<select onchange=chg_manu(this.value,document.search_form.manuid.value) name=jikan>'''''''''''''''''''''''''''
<option value=" " selected> 9:00~18:00 </option>
<option value=" "> 9:30~18:30 </option>
<option value=" "> 00:00~00:00 </option>
</select><font size=2>   </font>
<input type="text" name="bikou" size="20"> <br>
<%
if day > 31 then
exit do
end if
day = day + 1
Loop
%>
</body>
</html>
x_gn 2004-01-14
  • 打赏
  • 举报
回复
这是一个完整版,界面你自己修改一下


<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<FORM id=f>
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY>年<SELECT id=s1 onchange=vbs:aaa name=s1></SELECT> 月<SELECT id=s2
onchange=vbs:aaa name=s2></SELECT> 日<SELECT id=s3 name=s3></SELECT> </FORM>
<SCRIPT language=vbscript>
'初始年
MyAdd "f.s1",1970,2050
'初始月
MyAdd "f.s2",1,12
'初始日
MyAdd "f.s3",1,31
sub MyAdd(S,x,y)'增加
set obj=eval(S)
for i=x to y
set o=document.createElement("OPTION")
o.text=i
o.value=i
obj.add o
next
end sub
sub MyRemove(S)'删除
set obj=eval(S)
for each opt in obj.options
obj.remove opt.index
next
end sub
sub aaa
dim mydate,maxdate
MyRemove "f.s3"
for i=1 to 31
mydate=f.s1.value & "-" & f.s2.value & "-" & i
if isdate(mydate) then '判断是否是有效日期
maxdate=i
else
exit for
end if
next
MyAdd "f.s3",1,maxdate
end sub
</SCRIPT>
</BODY></HTML>
xieyj 2004-01-14
  • 打赏
  • 举报
回复
还是修改成以下这个函数吧,月份调用时就不用减一,直接在函数里减:
Function getDay(strYear, strMonth)
Dim arr
arr = "31,28,31,30,31,30,31,31,30,31,30,31"
arr = split(arr, ",")
if (strYear Mod 4 = 0) And ((strYear Mod 100 <> 0) Or (strYear Mod 400 = 0)) then arr(1) = 29 else arr(1) = 28
getDay = arr(strMonth-1)
End Function
xieyj 2004-01-14
  • 打赏
  • 举报
回复
调用时,使用:
getDay(年,月-1)
记得月份得减一
xieyj 2004-01-14
  • 打赏
  • 举报
回复
不好意思,刚刚调了一下,以上函数有点问题这里修正:
Function getDay(strYear, strMonth)
Dim arr
arr = "31,28,31,30,31,30,31,31,30,31,30,31"
arr = split(arr, ",")
if (strYear Mod 4 = 0) And ((strYear Mod 100 <> 0) Or (strYear Mod 400 = 0)) then arr(1) = 29 else arr(1) = 28
getDay = arr(strMonth)
End Function
xieyj 2004-01-14
  • 打赏
  • 举报
回复
1.刚才写了一个,没有测试过,应该没有问题的,输入参数为年,月:
Function getDay(strYear, strMonth)
ReDim arr(31,28,31,30,31,30,31,31,30,31,30,31)
if (strYear Mod 4 = 0) And ((strYear Mod 100 <> 0) Or (strYear Mod 400 = 0)) then arr(1) = 29 else arr(1) = 28
getDay = arr(strMonth)
End Function
PPLUNCLE 2004-01-14
  • 打赏
  • 举报
回复
楼主最好是先弄懂这些代码的含意,不要一味的copy,这样就会进步得更快些!
xieyj 2004-01-14
  • 打赏
  • 举报
回复
2.动态更改时间
<script language=vbs>
sub kind_onchange
if document.all("kind").value = "无休" then
document.all("time").value = "00:00~00:00"
end if
end sub
</script>
3.动态提交
<script language=vbs>
f.action = "接收页面地址"
f.submit()
</script>
PPLUNCLE 2004-01-14
  • 打赏
  • 举报
回复
回答:
1:不知道楼主的意思;

2:可以参照下面的帖子中的联动菜单
http://expert.csdn.net/Expert/topic/2661/2661683.xml?temp=.6863367

3:
给你代码,是预览的,搂住可以相应的作出修改:
---gopreview.asp------

<html>
<head>
<script language="javascript">
function gopreview()
{
document.forms[1].title.value=document.forms[0].subject.value;
document.forms[1].body.value=document.forms[0].Content.value;
var popupWin = window.open('preview.asp', 'preview_page', 'scrollbars=yes,width=400,height=450');
document.forms[1].submit()
}
</script>
</head>
<%
response.Write request("subject")
%>
<body>
<form action="gopreview.asp" method="post" name="previews">
<input type="text" name="subject" value="">
<input type="text" name="Content" value="">
<input type="submit" name="click" onclick="gopreview()" value="conli">
<input type="hidden" name="action" value="ceshi">
</form>
<form action="preview.asp" method="post" name="preview" target=preview_page>
<input type="hidden" value="" name="title">
<input type="hidden" value="" name="body">
</form>
</body>
</html>


----preview.asp----

<%
response.write request("title")&"<br>"
response.write request("body")
%>

28,407

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧