为何不出现警告框呢?

aw11181208 2004-05-08 07:22:52
大家看看以下的简单程序,为何我已经做了判断,但表单为空时提交,为何没有出现我想要的警告框呢?我把编写判断的那几句列出来,请大家帮忙看看,行不?
<!--#include file="conn02.asp"-->
<%
if request.form("xhname")="" then
response.write"<SCRIPT language=JavaScript>alert('学号不能为空!');"
response.write"javascript:history.go(-1)</SCRIPT>"
end if
if request.form("xmname")="" then
response.write"<SCRIPT language=JavaScript>alert('姓名不能为空!');"
response.write"javascript:history.go(-1)</SCRIPT>"
end if
xh=trim(request.form("xhname"))
xm=trim(request.form("xmname"))
set rs=server.createobject("adodb.recordset")
sql="select * from cjcx where 学号='"&xh&"' and 姓名='"&xm&"'"
rs.open sql,conn,1,1
%>
...全文
62 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
jiffer 2004-05-08
  • 打赏
  • 举报
回复
<%
if request.form("xhname")="" then
response.write"<SCRIPT>alert('学号不能为空!');history.go(-1)</SCRIPT>"
response.end
end if
if request.form("xmname")="" then
response.write"<SCRIPT>alert('姓名不能为空!');history.go(-1)</SCRIPT>"
response.end
end if
lawdoor 2004-05-08
  • 打赏
  • 举报
回复
<%
response.write("<script language=javascript>alert('对不起!');location.replace('part_manage.asp')</script>")
response.end '注意这句
%>

28,409

社区成员

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

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