加入下面的VBCRIPT脚本就无法向数据库提交数据,不加可以。。。

danielzyc 2004-04-02 01:09:01
<%@ Language=VBScript %>
<!--#include virtual="/jishu/identifyjs.asp"-->
<!--#include virtual="/include/connection.inc"-->
<%
if not IsEmpty(Request.Form("addinfor")) then
sql="insert into jsdy (dyid,papertype,purpose,number,puser,data) values('"&Request.Form("dyid")&"','"&Request.Form("papertype")&"','"&Request.Form("purpose")&"','"&Request.Form("number")&"','"&Request.Form("puser")&"','"&Request.Form("data")&"')"
conn.execute(sql)
Response.Redirect"../jsdy.asp"
end if
%>
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="\css\nbhb.css" type=text/css rel=stylesheet>
<title>办公系统</title>
</HEAD>
<BODY leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form ACTION="addnewjsdy.asp" METHOD=POST name=formadd id=formadd>
<table width="775" border="1" cellpadding="0" cellspacing="0" align="center" height="100%" bgcolor="#ffffff"bordercolordark=#00659c bordercolorlight=#ffffff>
<tr>
<td>
<table width="775" border="0" cellpadding="0" cellspacing="0" height="100%" bgcolor="#ffffff" align=center class=h1>
<tr>
<td colspan=2 width=100% height=83><!--#include virtual="/include/title.inc"-->
</td>
</tr>
<tr>
<td colspan=2 width=100% height=30 background="/images/xuxian1.jpg">当前位置→文印室→电话清单→添加记录
</td>
</tr>
<tr>
<td width=190><!--#include virtual="/include/jishu.inc"-->
</td>
<td width=585>
<table width="100%" border="0" cellpadding="0" cellspacing="0" height="100%" class=h1>
<tr>
<td height=50 align=center>
</td>
</tr>
<tr>
<td height=210>
<table width="100%" border="0" cellpadding="0" cellspacing="0" height="100%" class=h1>
<tr>
<td height=30>    编    号:    <input size=12 name="dyid" maxlength="30" tabindex="1" id="dyid">
</td>
</tr>
<tr>
<td height=30>    纸张类型:    <input size=12 name="papertype" maxlength="30" tabindex="1" id="papertype">
</td>
</tr>
<tr>
<td height=30>    打印用途:    <input size=12 name="purpose" maxlength="30" tabindex="1" id="purpose">
</td>
</tr>
<tr>
<td height=30>    数    量:    <input size=12 name="number" maxlength="30" tabindex="1" id="number">(例:3,5)
</td>
</tr>
<tr>
<td height=30>    打 印 人:    <input size=12 name="puser" maxlength="30" tabindex="1" id="puser">
</td>
</tr>
<tr>
<td height=30>    打印日期:    <input size=12 name="data" maxlength="30" tabindex="1" id="data" value=<%=date()%>>(例:2003-1-1)
</td>
</tr>
<tr>
<td height=20>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height=30>    <input type=button value="提交记录" name=addinfor id=addinfor onclick="submitform()">   <input type=button value="重填记录" name=resetinfor id=resetinfor onclick="formreset()">   <input type=button value="返回" name=return id=return>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan=2 height=65><!--#include virtual="/include/end.inc"-->
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</BODY>
</HTML>
<script language="vbscript">
<!--
function validate()
validate=true
if trim(formadd.dyid.value)="" then
msgbox"请输入编号!"
validate=false
exit function
end if
if trim(formadd.papertype.value)="" then
msgbox"请输入张纸类型!"
validate=false
exit function
end if
if trim(formadd.purpose.value)="" then
msgbox"请输入打印用途!"
validate=false
exit function
end if
if trim(formadd.number.value)="" then
msgbox"请输入数量!"
validate=false
exit function
end if
if trim(formadd.puser.value)="" then
msgbox"请输入打印人!"
validate=false
exit function
end if
if trim(formadd.data.value)="" then
msgbox"请输入打印日期!"
validate=false
exit function
end if
end function

function submit()
formadd.submit
end function
function submitform()
if validate=false then
exit function
end if
submit()
end function

function formreset()
formadd.reset()
end function

function return_onclick()
location.href="../jsdy.asp"
end function
-->
</script>
<%
conn.close
set conn=nothing
%>
...全文
29 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

28,391

社区成员

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

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