📄 doc_input.asp
字号:
<%response.expires=0%>
<!--#include file="../asp/sqlstr.asp"-->
<!--#include file="../asp/bgsub.asp"-->
<%
'session.abandon
'Server.ScriptTimeOut=500
function opendb(DBPath,sessionname,dbsort)
dim conn
'if not isobject(session(sessionname)) then
Set conn=Server.CreateObject("ADODB.Connection")
'if dbsort="accessdsn" then conn.Open "DSN=" & DBPath
'if dbsort="access" then conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
'if dbsort="sqlserver" then conn.Open "DSN=" & DBPath & ";uid=wsw;pwd=wsw"
DBPath1=server.mappath("../db/jzud-oa.asa")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath1
set session(sessionname)=conn
'end if
set opendb=session(sessionname)
end function
%>
<!--#include file="../asp/getpopedom.asp"-->
<!--#include file="../asp/keepformat.asp"-->
<!--#include file="conn.asp"-->
<%
function strlength(inputstr)
dim length,i
length=0
for i=1 to len(inputstr)
if asc(mid(inputstr,i,1))<0 then
length=length+2
else
length=length+1
end if
next
strlength=length
end function
oabusyname=request.cookies("oabusyname")
oabusyusername=request.cookies("oabusyusername")
oabusyuserdept=request.cookies("oabusyuserdept")
oabusyuserlevel=request.cookies("oabusyuserlevel")
if oabusyusername="" then
response.write("<script language=""javascript"">")
response.write("window.top.location.href='default.asp';")
response.write("</script>")
response.end
end if
errstr=getpopedom("allow_manage_docstoreroom",oabusyusername)
if errstr<>"" then
response.redirect "../asp/disperrorinfo.asp?errorinfo="&errstr
response.end
end if
set conn=openconn("conn")
set rs=server.createobject("adodb.recordset")
sql="select * from TypeTable"
rs.open sql,conn,1
if rs.eof and rs.bof then
conn.close
set conn=nothing
set rs=nothing
response.write("<script language=""javascript"">")
response.write("alert(""请先增加档案资料类别!"");")
response.write("location.href=""TypeManage.asp"";")
response.write("</script>")
response.end
end if
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>档案资料录入</title>
<link rel="stylesheet" type="text/css" href="../css/css.css">
<script language="vbscript">
sub checkkey()
if window.event.keyCode >57 or window.event.keyCode <48 then
if window.event.keyCode<>45 and window.event.keyCode<>40 and window.event.keyCode<>41 then
window.event.keyCode=0
end if
end if
end sub
</script>
<script language="javascript">
function formcheck()
{
if (document.form1.doctitle.value=="")
{
alert("标题不能为空!");
document.form1.doctitle.focus();
return (false);
}
if (document.form1.dept.value=="")
{
alert("颁发部门不能为空!");
document.form1.dept.focus();
return (false);
}
if (document.form1.senddate.value=="")
{
alert("颁发日期不能为空!");
document.form1.senddate.focus();
return (false);
}
if (document.form1.sxdate.value=="")
{
alert("生效日期不能为空!");
document.form1.sxdate.focus();
return (false);
}
if (document.form1.doccontent.value=="")
{
alert("档案资料内容不能为空!");
document.form1.doccontent.focus();
return (false);
}
return (true);
}
</script>
</head>
<body bgcolor="#ffffff" topmargin="5" leftmargin="5">
<%
%>
<center>
<table align="center">
<tr>
<td><b>档案资料录入</b> </td>
</tr>
</table>
</center>
<%
if request.form("ok")=" 发 送 " then
errorinfo=""
Doc_Title=trim(request.form("doctitle"))
if Doc_Title="" or strlength(Doc_Title)>100 then
errorinfo=errorinfo&"标题不能为空,且不能超过50个汉字!<br>"
end if
Doc_TypeName=request.form("type")
Doc_KeyWord=trim(request.form("keyword"))
if Doc_KeyWord<>"" and strlength(Doc_KeyWord)>50 then
errorinfo=errorinfo&"关键词不能超过25个汉字!<br>"
end if
Doc_Dept=trim(request.form("dept"))
if Doc_Dept="" or strlength(Doc_Dept)>30 then
errorinfo=errorinfo&"颁发部门不能为空,且不能超过15个汉字!<br>"
end if
Doc_SendDate=trim(request.form("senddate"))
if Doc_SendDate="" or strlength(Doc_SendDate)>10 then
errorinfo=errorinfo&"颁发日期不能为空,且不能超过10个字符!<br>"
end if
if not isdate(Doc_SendDate) then
errorinfo=errorinfo&"请输入正确的颁发日期,如2001-9-1!<br>"
end if
Doc_SxDate=trim(request.form("sxdate"))
if Doc_SxDate="" or strlength(Doc_SxDate)>10 then
errorinfo=errorinfo&"生效日期不能为空,且不能超过10个字符!<br>"
end if
if not isdate(Doc_SxDate) then
errorinfo=errorinfo&"请输入正确的生效日期,如2001-9-1!<br>"
end if
Doc_Content=request.form("doccontent")
if Doc_Content="" then
errorinfo=errorinfo&"档案资料内容不能为空!<br>"
end if
if errorinfo="" then
on error resume next
SQL="insert into ContentTable(TypeName,Title,KeyWord,Dept,SendDate,AvailabilityDate,Content) values("&sqlstr(Doc_TypeName)&","&sqlstr(Doc_Title)&","&sqlstr(Doc_KeyWord)&","&sqlstr(Doc_Dept)&",#"&Doc_SendDate&"#,#"&Doc_SxDate&"#,"&sqlstr(Doc_Content)&")"
conn.execute(SQL)
response.write("<center><font color=#ee0000 size=+1>该条档案资料录入成功!<font><br><br>"&keepformat(err.description))
response.write("<input type=""button"" onclick=""location.href='Doc_Input.asp'"" value=""继续增加""></center>")
else
conn.close
set conn=nothing
set rs=nothing
%>
<div align="center">
<table width="80%" border="0">
<tr><td>
<center><b><font color="red" size="+1">出错了</font></b></center><br><br>
<font color="#ee0000" size="+1"><%=errorinfo%></font>
<center><input type="button" value="返回" onclick="javascript:history.go( -1 );return true;"></center>
</td></tr></table>
</div>
<%
end if
else
%>
<br>
<center>
<form method="POST" action="Doc_Input.asp" name="form1" onsubmit="javascript:return formcheck();">
<div align="center">
<center>
<table border="1" cellpadding="5" cellspacing="0" width="80%" bordercolorlight="#808080" bordercolordark="#D4D0C8">
<tr>
<td height="25" width="98" align="center">标 题:</td>
<td height="25" width="396">
<textarea rows="5" name="doctitle" cols="52" maxlength="100"></textarea><font color="#FF0000">*</font></td>
</tr>
<tr>
<td height="25" width="98" align="center">类 别:</td>
<td height="25" width="396">
<select size="1" name="type">
<%
do while not rs.eof
response.write("<option value="&chr(34)&rs("TypeName")&chr(34)&">"&keepformat(rs("TypeName"))&"</option>")
rs.movenext
loop
%>
</select>
</td>
</tr>
<tr>
<td height="25" width="98" align="center">关 键 词:</td>
<td height="25" width="396">
<input type="text" name="keyword" size="53" maxlength="50"></td>
</tr>
<tr>
<td height="25" width="98" align="center">颁发部门:</td>
<td height="25" width="396"><input type="text" name="dept" size="53" maxlength="30"><font color="#FF0000">*</font></td>
</tr>
<tr>
<td height="25" width="98" align="center">颁发日期:</td>
<td height="25" width="396"><font color="#FF0000"><input type="text" name="senddate" size="53" maxlength="10" onkeypress="vbscript:checkkey()">*</font></td>
</tr>
<tr>
<td height="25" width="98" align="center">生效日期:</td>
<td height="25" width="396"><input type="text" name="sxdate" size="53" maxlength="10" onkeypress="vbscript:checkkey()"><font color="#FF0000">*</font></td>
</tr>
<tr>
<td height="25" width="98" align="center">内 容:</td>
<td height="25" width="396"><textarea rows="8" name="doccontent" cols="52"></textarea><font color="#FF0000">*</font></td>
</tr>
</table>
</center>
</div>
<p align="center"><input type="submit" value=" 发 送 " name="ok">
<input type="reset" value=" 重 填 " name="B2"></p>
</form>
<%
conn.close
set conn=nothing
set rs=nothing
end if
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -