类型:转载 责任编辑:asp.net 日期:2007/05/23
热门软件下载:
页面有几个文本框,
在文本框中输入内容后按保存按钮向后台提交
后台检查提交的数据,如果不符合的
<%
response.write "<script>alert(输入有误);history.back();</script>"
response.end
%>
点确定返回后为什么刚输入的文本框中的内容没有了?可有些页面后退内容是有的?
网友回答:
应该是有内容才对啊,奇怪
禁止页面缓存就是这样子的
去掉response.end
应该就可以了
<%
Response.Write("<script>alert(输入有误);history.go(-1);</script>")
Response.End()
%>
再不行,除非你ie设置有误。
你输入的文本框给个值
---------------------------=in a page
<input type="text" value="<%=request.Cookie("zhi")%>" id="a">
----------------------------=in b page
<%
a=request("a")
if not a="" Then
response.Cookie("zhi")=a
End if
...
response.write "<script>alert(输入有误);history.back();</script>"
response.end
%>
如果页面必须要禁止缓存,就不能用“history.back();"
改正如下:用url传参数的方法
<%
response.write "<script>"
response.write" alert(输入有误);window.location=#?A=1&B=2&c+3;"
response.write"</script>"
%>
密码输入框不行的啊
同意DAVERY的说法,除了密码框以外,其它的表单组件的值 在返回的时候都会保存的。
response.buffer=true
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
就是是因为禁止缓存了!