add_info.asp
来自「ASP+SQL Server的图书馆管理系统」· ASP 代码 · 共 263 行
ASP
263 行
<!--#include File="conndb.asp"-->
<!--#include File="isAdmin.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>借阅登记</title>
<link href="style.css" rel="stylesheet">
<SCRIPT language="javascript">
function fucCheckNUM(NUM)
{
var i,j,strTemp;
strTemp="0123456789.";
if (NUM.length==0)
return 0;
for (i=0;i<NUM.length;i++)
{
j=strTemp.indexOf(NUM.charAt(i));
if (j==-1)
{
//说明有字符不是数字
return 0;
}
}
//说明是数字
return 1;
}
</SCRIPT>
<SCRIPT type="text/javascript">
<!--
function form1_onsubmit()
{
if(document.form1.rec_bktotal.value.length<1)
{
alert("您必须输入借阅图书数量!");
document.form1.rec_bktotal.focus();
return false;
}
if ((fucCheckNUM(document.form1.rec_bktotal.value)==0) )
{ alert ("借阅数量有非法字符,请填写正确借阅数量。");
document.form1.rec_bktotal.focus();
return false;
}
return true;
}
//-->
</SCRIPT>
</head>
<!--#include file="head.asp"-->
<body text="#000000" link="#000080" vlink="#080080">
<form name="form1" method="post" onsubmit="return form1_onsubmit()" action="Add_Info_ok.asp">
<%dim count
set rs=server.createobject("adodb.recordset")
rs.open "select * from book_info ",conn,1,1%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("book_name"))%>","<%= rs("book_type")%>","<%= trim(rs("book_name"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.form1.rec_bkname.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.form1.rec_bkname.options[document.form1.rec_bkname.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
<center>
<p align="center"><b><font style="font-size: 12pt">图 书 借 阅 登 记</font></b></p>
<BR>
<table cellspacing=1 cellpadding=4 width=524 bgcolor=#3399FF height="283">
<%
rs.open "select * from book_type order by type_id",conn,1,1
if rs.eof and rs.bof then
response.write "无法打开数据库!"
response.end
else
%>
<tbody>
<tr>
<td width=108 bgcolor=#FEEC85 height=24 align="right" style='FONT-SIZE: 10pt'><strong>借阅种类:</strong></td>
<td width=425 height=24 bgcolor="#ffffff">
<select name="rec_bktype" size="1" id="rec_bktype" onChange="changelocation(document.form1.rec_bktype.options[document.form1.rec_bktype.selectedIndex].value)">
<option value="0">==请选择==</option>
<% dim selclass
selclass=rs("type_id")
do while not rs.eof
%>
<option value="<%=rs("type_id")%>"><%=rs("Type_Name")%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select> </td>
</tr>
<tr>
<td width=108 bgcolor=#FEEC85 height=24 align="right" style='FONT-SIZE: 10pt'><strong>图书名称:</strong></td>
<td width=425 height=24 bgcolor="#ffffff">
<select name="rec_bkname">
<%
rs.open "select * from book_info where book_type="&selclass ,conn,1,1
if not(rs.eof and rs.bof) then
%>
<option selected value="0">==请选择==</option>
<% do while not rs.eof%>
<option value="<%=rs("book_name")%>"><%=rs("book_name")%></option>
<% rs.movenext
loop
end if
rs.close
set rs = nothing
%>
</select></td>
</tr>
<tr>
<td width=108 bgcolor=#FEEC85 height=25 align="right"style='FONT-SIZE: 10pt'><strong>借阅数量:</strong></td>
<td width=425 height=25 bgcolor="#ffffff">
<input type="text" name="rec_bktotal" size="10" ></td>
</tr>
<%dim count1
set rs1=server.createobject("adodb.recordset")
rs1.open "select * from reader_info ",conn,1,1%>
<script language = "JavaScript">
var onecount1;
onecount1=0;
subcat1 = new Array();
<%
count1 = 0
do while not rs1.eof
%>
subcat1[<%=count1%>] = new Array("<%= trim(rs1("rdr_name"))%>","<%= rs1("rdr_type")%>","<%= trim(rs1("rdr_name"))%>");
<%
count1= count1 + 1
rs1.movenext
loop
rs1.close
%>
onecount1=<%=count1%>;
function changelocation1(locationid1)
{
document.form1.rec_rdrname.length = 0;
var locationid1=locationid1;
var i;
for (i=0;i < onecount1; i++)
{
if (subcat1[i][1] == locationid1)
{
document.form1.rec_rdrname.options[document.form1.rec_rdrname.length] = new Option(subcat1[i][0], subcat1[i][2]);
}
}
}
</script>
<tr>
<td width=108 bgcolor=#FEEC85 height=25 align="right"style='FONT-SIZE: 10pt'><strong>读者类型:</strong></td>
<td width=425 height=25 bgcolor="#ffffff">
<%
rs1.open "select distinct rdr_type from reader_info order by rdr_type",conn,1,1
if rs1.eof and rs1.bof then
response.write "无法打开数据库!"
response.end
else
%> <select name="rec_rdrtype" size="1" id="rec_rdrtype" onChange="changelocation1(document.form1.rec_rdrtype.options[document.form1.rec_rdrtype.selectedIndex].value)">
<option value="0" selected>==请选择==</option>
<% dim selclass1
selclass1=rs1("rdr_type")
do while not rs1.eof
%>
<option value="<%=rs1("rdr_type")%>"><%=trim(rs1("rdr_type"))%></option>
<%
rs1.movenext
loop
end if
rs1.close
%>
</select> </td>
</tr>
<tr>
<td width=108 bgcolor=#FEEC85 height=25 align="right"style='FONT-SIZE: 10pt'><strong>读者姓名:</strong></td>
<td width=425 height=25 bgcolor="#ffffff">
<select name="rec_rdrname">
<%
rs1.open "select * from reader_info where rdr_type="&selclass1 ,conn,1,1
if not(rs1.eof and rs1.bof) then
%>
<option selected value="0">==请选择==</option>
<% do while not rs1.eof%>
<option value="<%=rs1("rdr_id")%>"><%=rs1("rdr_name")%></option>
<% rs1.movenext
loop
end if
rs1.close
set rs1 = nothing
%>
</select> </td>
</tr>
<tr>
<td width=108 bgcolor=#FEEC85 height=25 align="right"style='FONT-SIZE:
10pt'><strong>借阅时间:</strong></td>
<td width=425 height=25 bgcolor="#ffffff"><input type="text" name="rec_lendtime" size="20" value=<%=DateAdd("m", 0 , date()) %>>
</td>
</tr>
<tr>
<td width=108 bgcolor=#FEEC85 height=25 align="right"style='FONT-SIZE: 10pt'><strong>应还时间:</strong></td>
<td width=425 height=25 bgcolor="#ffffff"><input type="text" name="rec_lendlimit" size="20" value=<%=DateAdd("m", 2 , date()) %>>
</td>
</tr>
<tr>
<td width=108 bgcolor=#FEEC85 height=25 align="right"style='FONT-SIZE: 10pt'><strong>备注:</strong></td>
<td width=425 height=25 bgcolor="#ffffff"><textarea rows="4" name="rec_remark" cols="40" ></textarea></td>
</tr>
</tbody>
</table>
</center>
</div>
<tr >
<td colspan=2 height="27"bgcolor=#ffffff><p align="center">
<input type=submit size=3 value='登记' name=Submit2 >
<input type=reset value="重写" name="B4" size=3>
</td>
</tr>
<tr>
<td><div align="center">
<p>Copyright 2007 </p>
</div></td>
</tr>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?