加入下面的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
%>
...全文
5 点赞 收藏 回复
写回复
回复
切换为时间正序
请发表友善的回复…
发表回复

还没有回复,快来抢沙发~

发动态
发帖子
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
社区公告
暂无公告