急问:执行了程序,但却没有显示出来

thunderingman 2008-11-02 09:09:19
response.write "<script>alert('还书成功');location.href='loans.asp';</script>"

程序运行时没有报错,而且通过单步执行,确实是执行了上面这句程序
但却没有弹出"还书成功"的按钮,也没有链接到loans.asp
而是什么都没有显示
大家遇到过这个问题吗?
是怎么回事?
...全文
101 22 打赏 收藏 转发到动态 举报
写回复
用AI写文章
22 条回复
切换为时间正序
请发表友善的回复…
发表回复
thunderingman 2008-11-03
  • 打赏
  • 举报
回复
自己顶
thunderingman 2008-11-02
  • 打赏
  • 举报
回复
好的
谢谢大家了
  • 打赏
  • 举报
回复
连接符用&吧,不要用+

你先改这个

我觉得你肯定在哪个地方有错

你自己检查

肯定有容错的地方
不然不会这样
thunderingman 2008-11-02
  • 打赏
  • 举报
回复
我用17楼的方法
response.write " <script>"&chr(13)&"alert('对不起,没有搜索到记录!');history.back();"&chr(13)&" </script>"

还是不行
  • 打赏
  • 举报
回复
你把history.go(-1)换成history.back()试试
toury 2008-11-02
  • 打赏
  • 举报
回复
<link href="style.css" type="text/css" rel="stylesheet">
<!--#include file="conn.asp"-->
<%'定义记录集和变量

bookname=trim(request("bookname"))
booktype=request("booktype")
author=trim(request("author"))
publishing=trim(request("publishing"))
abstract=trim(request("abstract"))
money1=trim(request("money1"))
money2=trim(request("money2"))
date1=trim(request("date1"))
date11=trim(request("date11"))
date2=trim(request("date2"))
date22=trim(request("date22"))
date3=trim(request("date3"))
date33=trim(request("date33"))
date111=date1&"-"&date2&"-"&date3
date222=date11&"-"&date22&"-"&date33

sql="select * from book where 1=1 "

if booktype <>"" then
sql=sql+"and booktype like '%"&booktype&"%'"
end if
if bookname <>"" then
sql=sql+"and bookname like '%"&bookname&"%'"
end if
if author <>"" then
sql=sql+"and author like '%"&author&"%' "
end if
if publishing <>"" then
sql=sql+"and publishing like '%"&publishing&"%' "
end if
if abstract <>"" then
sql=sql+"and abstract like '%"&abstract&"%' "
end if

sql=sql+"and bookmoney>'"&money1&"' and bookmoney <='"&money2&"' and pdate between '"&date111&"' and '"&date222&"' order by id asc"
set rs=server.createobject("adodb.recordset")
rs.open sql,db,1,3

if rs.eof or rs.bof then
response.write " <script>"&chr(13)&"alert('对不起,没有搜索到记录!');history.back();"&chr(13)&" </script>"
response.end
else
...
后面些省略了
thunderingman 2008-11-02
  • 打赏
  • 举报
回复
conn.asp里没有
  • 打赏
  • 举报
回复
还有你的用的VBS
连接符用&吧,不要用+
  • 打赏
  • 举报
回复
<!--#include file="conn.asp"-->

你这个文件里确定没有吗?》?

一般都写在这个里了
thunderingman 2008-11-02
  • 打赏
  • 举报
回复
在没有用到的一个asp文件里有的
但是没有链接到这个文件
没用到过
  • 打赏
  • 举报
回复
on error resume next

就是这个啊
thunderingman 2008-11-02
  • 打赏
  • 举报
回复
什么叫容错代码?
  • 打赏
  • 举报
回复
<!--#include file="conn.asp"-->

你这个里面是不是有容错代码?
thunderingman 2008-11-02
  • 打赏
  • 举报
回复
后面需要"response.redirect"吗?
我其它的文件里也没有"response.redirect"
但都能能够显示出来
就这个文件显示不出来
不知是哪里的问题
thunderingman 2008-11-02
  • 打赏
  • 举报
回复
按照你们的方法
会报错
<%缺少语句
Anlige 2008-11-02
  • 打赏
  • 举报
回复
你后面没有response.redirect之类的语句吧?
toury 2008-11-02
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 toury 的回复:]
HTML code<%response.write"<script>"&chr(13)&"alert('还书成功');location.href='loans.asp';"&chr(13)&"</script>"%>
[/Quote]

用上面的方法;
或者:
<%
if aaa then
%>
<script>.................</script>
<%
else

end if
%>
thunderingman 2008-11-02
  • 打赏
  • 举报
回复
<link href="style.css" type="text/css" rel="stylesheet">
<!--#include file="conn.asp"-->
<%'定义记录集和变量

bookname=trim(request("bookname"))
booktype=request("booktype")
author=trim(request("author"))
publishing=trim(request("publishing"))
abstract=trim(request("abstract"))
money1=trim(request("money1"))
money2=trim(request("money2"))
date1=trim(request("date1"))
date11=trim(request("date11"))
date2=trim(request("date2"))
date22=trim(request("date22"))
date3=trim(request("date3"))
date33=trim(request("date33"))
date111=date1&"-"&date2&"-"&date3
date222=date11&"-"&date22&"-"&date33

sql="select * from book where 1=1 "

if booktype<>"" then
sql=sql+"and booktype like '%"&booktype&"%'"
end if
if bookname<>"" then
sql=sql+"and bookname like '%"&bookname&"%'"
end if
if author<>"" then
sql=sql+"and author like '%"&author&"%' "
end if
if publishing<>"" then
sql=sql+"and publishing like '%"&publishing&"%' "
end if
if abstract<>"" then
sql=sql+"and abstract like '%"&abstract&"%' "
end if

sql=sql+"and bookmoney>'"&money1&"' and bookmoney<='"&money2&"' and pdate between '"&date111&"' and '"&date222&"' order by id asc"
set rs=server.createobject("adodb.recordset")
rs.open sql,db,1,3

if rs.eof or rs.bof then
response.write "<script>alert('对不起,没有搜索到记录!');history.go(-1)</script>"
response.end
else
...
后面些省略了

这是原代码
红色标出来的,在单步时是执行的
但是却不会跳出按钮来
toury 2008-11-02
  • 打赏
  • 举报
回复

<%
response.write "<script>"&chr(13)&"alert('还书成功');location.href='loans.asp';"&chr(13)&" </script>"
%>
  • 打赏
  • 举报
回复
你肯定有错误的地方,你是不是有容错代码?

去掉容错代码看看
加载更多回复(2)

28,390

社区成员

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

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