| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1298 人关注过本帖
标题:[求助]使用javascript跳转页面,为何会没了之前显示的内容?
只看楼主 加入收藏
janefishfish
Rank: 1
等 级:新手上路
帖 子:50
专家分:0
注 册:2006-6-24
收藏
 问题点数:0 回复次数:11 
[求助]使用javascript跳转页面,为何会没了之前显示的内容?
当用户输入的验证码出错时,我使用以下语句
Response.Write"<script language=JavaScript>"
Response.Write"alert(""请输入正确的验证码"");"
Response.Write"window.location='regist.asp','top'"
Response.Write"</script>"
response.end
end if
但是为何用Response.Write"window.location='regist.asp','top'"语句跳转到regist.asp时,用户之前输入的信息会没有了?

搜索更多相关主题的帖子: javascript 页面 
2006-07-23 15:57
janefishfish
Rank: 1
等 级:新手上路
帖 子:50
专家分:0
注 册:2006-6-24
收藏
得分:0 
我有试过这个语句 Response.Write"<script language=JavaScript>"
Response.Write"alert('请输入正确的验证码');"
Response.Write"javascript:history.Go(-1)"
Response.Write"</script>"
但是返回不到regist.asp.

2006-07-23 16:03
janefishfish
Rank: 1
等 级:新手上路
帖 子:50
专家分:0
注 册:2006-6-24
收藏
得分:0 

为什么没人的?请各位帮帮忙


2006-07-24 08:15
gdk2006
Rank: 4
等 级:业余侠客
威 望:8
帖 子:928
专家分:270
注 册:2006-7-2
收藏
得分:0 
Response.Write"javascript:history.Go(-1)"

把这段改成:Response.Write"javascript:history.back(-1)"试试!!!!!

程序员的悲哀如何找女朋友?
追女解决方案百度“让她着迷”!
2006-07-24 08:30
gdk2006
Rank: 4
等 级:业余侠客
威 望:8
帖 子:928
专家分:270
注 册:2006-7-2
收藏
得分:0 

你要写关于验证的程序我建议你要么就写JAVASCRIPT函数function
或者是直接用VBscript写,我给你一个你试试!
这是一个用户注册的代码:
<!--#include file="conn.asp"-->
<% if request.Form("user")="" then
response.Write"<script language=javascript>alert('请输入用户名');history.back(-1);</script>"
response.End()
end if
if request.Form("pwd")="" then
response.Write"<script language=javascript>alert('请输入密码');history.back(-1);</script>"
response.End()
end if
if request.Form("pwd2")="" then
response.Write"<script language=javascript>alert('请再次输入密码');history.back(-1);</script>"
response.End()
end if
pwd=trim(request.Form("pwd"))
pwd2=trim(request.Form("pwd2"))
if not pwd=pwd2 then
response.Write"<script language=javascript>alert('两次密码输入不一致!请重新输入!');history.back(-1);</script>"
response.End()
end if
if request.Form("email")="" then
response.Write"<script language=javascript>alert('请输入邮箱');history.back(-1);</script>"
response.End()
end if
For I=1 to Len(request.Form("email"))
If Mid(request.Form("email"),i,1)="@" Then
Flag=1
End If
next
if Flag<>1 then
response.Write"<script language=javascript>alert('请输入合法的邮箱地址!');history.back(-1);</script>"
end if
if request.Form("question")="" then
response.Write"<script language=javascript>alert('请输入密码提示问题!');history.back(-1);</script>"
response.End()
end if
if request.Form("answer")="" then
response.Write"<script language=javascript>alert('请输入密码提示答案!');history.back(-1);</script>"
response.End()
end if
user=request.Form("user")
pwd=request.Form("pwd")
sex=request.Form("sex")
qq=request.Form("QQ")
email=request.Form("email")
underwrite=request.Form("underwrite")
question=request.Form("question")
answer=request.Form("answer")
image=request.Form("ihead")

set rs=server.createobject("adodb.recordset")
set rs1=server.createobject("adodb.recordset")
sql="select * from login where user='"&user&"'"
rs.open sql,conn,1,3
if rs.EOF or rs.BOF then
rs1.open"login",conn,1,3
rs1.addnew array("user","pwd","sex","QQ","email","underwrite","question","answer","image"),_
array(user,pwd,sex,QQ,email,underwrite,question,answer,image)
%>
<script language="vbscript">
window.location.href="login_2.asp"
</script>
<%
rs1.close
set rs1=nothing
%>
<%
else
%>
<script language="vbscript">
alert("对不起!此用户已存在!")
history.back
</script>
<%
end if
rs.Close
set rs=nothing
%>


程序员的悲哀如何找女朋友?
追女解决方案百度“让她着迷”!
2006-07-24 08:34
gdk2006
Rank: 4
等 级:业余侠客
威 望:8
帖 子:928
专家分:270
注 册:2006-7-2
收藏
得分:0 

给你一个用户注册验证的代码!
<!--#include file="conn.asp"-->
<% if request.Form("user")="" then
response.Write"<script language=javascript>alert('请输入用户名');history.back(-1);</script>"
response.End()
end if
if request.Form("pwd")="" then
response.Write"<script language=javascript>alert('请输入密码');history.back(-1);</script>"
response.End()
end if
if request.Form("pwd2")="" then
response.Write"<script language=javascript>alert('请再次输入密码');history.back(-1);</script>"
response.End()
end if
pwd=trim(request.Form("pwd"))
pwd2=trim(request.Form("pwd2"))
if not pwd=pwd2 then
response.Write"<script language=javascript>alert('两次密码输入不一致!请重新输入!');history.back(-1);</script>"
response.End()
end if
if request.Form("email")="" then
response.Write"<script language=javascript>alert('请输入邮箱');history.back(-1);</script>"
response.End()
end if
For I=1 to Len(request.Form("email"))
If Mid(request.Form("email"),i,1)="@" Then
Flag=1
End If
next
if Flag<>1 then
response.Write"<script language=javascript>alert('请输入合法的邮箱地址!');history.back(-1);</script>"
end if
if request.Form("question")="" then
response.Write"<script language=javascript>alert('请输入密码提示问题!');history.back(-1);</script>"
response.End()
end if
if request.Form("answer")="" then
response.Write"<script language=javascript>alert('请输入密码提示答案!');history.back(-1);</script>"
response.End()
end if
user=request.Form("user")
pwd=request.Form("pwd")
sex=request.Form("sex")
qq=request.Form("QQ")
email=request.Form("email")
underwrite=request.Form("underwrite")
question=request.Form("question")
answer=request.Form("answer")
image=request.Form("ihead")

set rs=server.createobject("adodb.recordset")
set rs1=server.createobject("adodb.recordset")
sql="select * from login where user='"&user&"'"
rs.open sql,conn,1,3
if rs.EOF or rs.BOF then
rs1.open"login",conn,1,3
rs1.addnew array("user","pwd","sex","QQ","email","underwrite","question","answer","image"),_
array(user,pwd,sex,QQ,email,underwrite,question,answer,image)
%>
<script language="vbscript">
window.location.href="login_2.asp"
</script>
<%
rs1.close
set rs1=nothing
%>
<%
else
%>
<script language="vbscript">
alert("对不起!此用户已存在!")
history.back
</script>
<%
end if
rs.Close
set rs=nothing
%>


程序员的悲哀如何找女朋友?
追女解决方案百度“让她着迷”!
2006-07-24 08:36
janefishfish
Rank: 1
等 级:新手上路
帖 子:50
专家分:0
注 册:2006-6-24
收藏
得分:0 
好的``謝謝```

2006-07-24 08:43
janefishfish
Rank: 1
等 级:新手上路
帖 子:50
专家分:0
注 册:2006-6-24
收藏
得分:0 
可以啦```感謝感謝````

2006-07-24 09:20
janefishfish
Rank: 1
等 级:新手上路
帖 子:50
专家分:0
注 册:2006-6-24
收藏
得分:0 

不过照理response.write"Javascript:history.GO(-1)"不可以的?真是奇怪`````~~


2006-07-24 09:22
janefishfish
Rank: 1
等 级:新手上路
帖 子:50
专家分:0
注 册:2006-6-24
收藏
得分:0 

咦```楼上楼上楼上的验证也不错```
不过用这么多if语句会不会不好的?因为我听我的朋友说过尽量少用if语句,必要时可以用另外一此语句替代.


2006-07-24 13:24
快速回复:[求助]使用javascript跳转页面,为何会没了之前显示的内容?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.049594 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved