📄 提交作业.txt
字号:
<% 'from jxHWenter URL链接入:?work=A&ml=zhe
xuehao = Request.Cookies("jxyd_user_nstu")
xingming = Request.Cookies("jxyd_user_xmin") '由cookies保存的学号、姓名
sHW = Request.QueryString("work")
sDir= Request.QueryString("ml") '由前页传递的作业号、目录
iphao = Request.ServerVariables ("REMOTE_ADDR")
sFile = Server.MapPath("/jxyd/HomeWork") &"/"& sDir &"/Work"& sHW &"put.txt"
Set MyFile = Server.CreateObject ("Scripting.FileSystemObject")
tishu = 0
Set MyText = MyFile.OpenTextFile(sFile, 1) '读出题目的文本文件
do
sLine = MyText.ReadLine
if left(sLine, 5) = "-end-" then exit do
if left(sLine,1) = "#" then
sTemp = mid(sLine, 2, 2): rRiqi = mid(sLine, 5): timu = "": tishu = tishu + 1
else
timu = timu & sLine &"<br>"
end if
loop
MyText.close: zuoye = "现在时间是"& now() &"已过了交作业的截止日期。"
Set dbc = Server.CreateObject("ADODB.Connection")
strConn = "driver={Microsoft Access Driver (*.mdb)}" '数据库连接
dbc.open strConn & ";dbq=" & Server.MapPath( "/jxyd/HomeWork/"& sDir &"/Work"& left(sTemp, 1)
&"Get.mdb")
sql = "select 内容 from 作业题目 where 学号='" & xuehao & "'"
Set rs = dbc.execute(sql)
if rs.eof then '以前未提交过作业
sReadFromDB = ""
else
sReadFromDB = rs(0): sReadFromDB = replace(sReadFromDB, "<BR>", vbCrLf)
end if
Set rs = Nothing: Set dbc = Nothing
%>
<html><head><title><%= right(xuehao,2) %>作业</title>
<meta content='text/html; charset=gb2312' http-equiv='Content-Type'>
<style type="text/css">
body,td,th{font-family:宋体;font-size:13px}
</style></head>
<%
Response.Write "<body bgColor=#D9ECFF><table border='0' width='90%'align='center' cellspacing='1'>"&_
"<tr><td><font style='FONT-SIZE: 35px' color=red><b>网络提交作业
</b></font></td></tr></table>"&_
"<table border='0' cellpadding=1 cellspacing=1 width='95%'>"&_
"<tr><form method='post' action='ch8-jxZuoYeOK1.asp' name='form'>"&_
"<td colspan=2><b>"& sWorkName &"作业号</b>:<font color=red>"& stemp &"</font>" '提交给
jxZuoYeOK1.asp 六个form字段
Response.Write " (提交的作业可多次修改更新覆盖,截止至"& rRiqi &" 20时)<br><b>题目</b>:
</td></tr>"&_
"<tr><td colspan=2><font color=blue>"& timu &"</font>"&_
"<hr width=100% align=left></td></tr>"&_
"<tr><td colspan=2><b>学号</b>:<font color=blue>"& xuehao &"</font> <b>姓名</b>:
<font color=blue>"& xingming &"</font>"&_
"<b>IP号</b>:<font color=blue>"& iphao &"</font>"&_
"<br><textarea name='zuoye' rows='6' cols='80' style='BACKGROUND-COLOR: FAFCEE; FONT-
FAMILY: 宋体; FONT-SIZE: 14px'>"&_
sReadFromDB &"</textarea><br>"
if DateDiff("d", rRiqi, date()) > 0 then
Response.Write zuoye '如已过提交的截止日期,显示作业已截止
else
Response.write "<input id='submit1' name='tijiao' type=submit value='将作业文本填入上框内后提
交'>"&_
"<input type='hidden' name='xuehao' value='"& xuehao &"'>"&_
"<input type='hidden' name='xingming' value='"& xingming &"'>"&_
"<input type='hidden' name='iphao' value='"& iphao &"'>"&_
"<input type='hidden' name='dir' value='"& sDir &"'>"&_
"<input type='hidden' name='tihao' value='"& sTemp &"'>"
end if
Response.Write "</td></form></tr></table>"
Response.Write "<table border=0 cellpadding=1 cellspacing=1 width='95%'>"&_
"<tr><td width=70><b>作业查询</b>|</td><td align=left>"
if tishu > 1 then
for i = 1 to tishu – 1 '链接jxLookWork1.asp?hao=AC&ml=zhe 查阅以前的作业
si = cstr(i): if i > 9 then si = chr(i + 55)
Response.Write "<a href='ch8-jxLookWork1.asp?hao="& left(sTemp, 1) & si &"&ml="& sDir
&"'>"& left(sTemp, 1) & si &"</a> | "
next
end if
Response.Write "</td></tr></table>"
Response.Write "</body></html>"
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -