request不能在过程里调用吗????????????????

lyhold 2002-12-30 01:30:16
Sub baocun_OnClick

document.all.gg.value=request.cookies("gonggao")//包错,缺少对象
End Sub
...全文
37 34 打赏 收藏 转发到动态 举报
写回复
用AI写文章
34 条回复
切换为时间正序
请发表友善的回复…
发表回复
lyhold 2002-12-30
  • 打赏
  • 举报
回复
to lbd8848
http://expert.csdn.net/Expert/topic/1305/1305272.xml?temp=.5915796

去看哪个问题,我另送你100分,谢谢你的帮助!
lyhold 2002-12-30
  • 打赏
  • 举报
回复
明白,谢谢!!!

lbd8848 2002-12-30
  • 打赏
  • 举报
回复
或使用request.form("gonggao")
lbd8848 2002-12-30
  • 打赏
  • 举报
回复
request("gonggao")是从1.asp中传过来的<textarea name=gonggao></textarea>的值

lyhold 2002-12-30
  • 打赏
  • 举报
回复
谢谢 lbd8848
在你的指导下,我一调试通过

请问最后一个问题,我这有点不明白这句话

txt.writeline(request("gonggao"))

gonggao怎么是一个request变量呢,前面没有定义只有个同名的cookie叫
gonggao

给分啦。
谢谢。
lbd8848 2002-12-30
  • 打赏
  • 举报
回复
<html>

<SCRIPT LANGUAGE="vbScript">
Sub chexiao_OnClick
document.all.chexiao.value = "test"
End Sub
</script>
<body>
<%
set fs1=server.createobject("Scripting.FileSystemObject")
filepath=server.MapPath("gonggao.txt")
set txt=fs1.opentextfile(filepath)
gg=txt.readline
response.cookies("gg")=gg
response.cookies("gg").expires="2002/12/31"
txt.close
set fs1=nothing

%>

<form method=post action=2.asp>
<td width="100%" rowspan="2" height="1"><textarea rows="20" name="gonggao" cols="86"><%=request.cookies("gg")%> </textarea>
<input type=submit value="保存"><br>
<p><input type="button" value="撤 消" name="chexiao"></p>
<p><input type="button" value="返 回" name="fanhui"></p>

</form>
</body>
</html>

2.asp
____


<%

set fs=server.createobject("Scripting.FileSystemObject")
filepath=server.MapPath("gonggao.txt")
set txt=fs.createtextfile(filepath,true)
txt.writeline(request("gonggao"))
txt.close
set fs=nothing
response.redirect "1.asp"
%>
lyhold 2002-12-30
  • 打赏
  • 举报
回复
我现在是这样的。页面载入的时候跟一个gonggao控件副值(文本文件中取的),

如果用户修改后点保存则写到文本文件,否则把以前的哪个值(存在cookie)
去出来重新副给text
lbd8848 2002-12-30
  • 打赏
  • 举报
回复
如果想看到gongao保存的值可以在2.asp中加
response.cookies("gg")=request("gonggao")
lbd8848 2002-12-30
  • 打赏
  • 举报
回复
1.asp
---
<html>

<SCRIPT LANGUAGE="vbScript">
Sub chexiao_OnClick
document.all.chexiao.value = "test"
End Sub
</script>

<body>
<form method=post action=2.asp>
<td width="100%" rowspan="2" height="1"><textarea rows="20" name="gonggao" cols="86"><%=request.cookies("gg")%> </textarea>
<input type=submit value="保存"><br>
<p><input type="button" value="撤 消" name="chexiao"></p>
<p><input type="button" value="返 回" name="fanhui"></p>

</form>
</body>
</html>

2.asp
____


<%

set fs=server.createobject("Scripting.FileSystemObject")
filepath=server.MapPath("gonggao.txt")
set txt=fs.createtextfile(filepath,true)
txt.writeline(request("gonggao"))
txt.close
set fs=nothing
response.redirect "1.asp"
%>
lbd8848 2002-12-30
  • 打赏
  • 举报
回复
最好这样做:
1.asp
---
<html>
<SCRIPT LANGUAGE="VBScript">
Sub baocun_OnClick()
document.all.gonggao.value=<% =request.cookies("gg")%>
End Sub
</script>

<SCRIPT LANGUAGE="vbScript">
Sub chexiao_OnClick
document.all.chexiao.value = "test"
End Sub
</script>

<body>
<form method=post action=2.asp>
<td width="100%" rowspan="2" height="1"><textarea rows="20" name="gonggao" cols="86"><%=request.cookies("gg")%> </textarea>
<input type=submit value="保存"><br>
<p><input type="button" value="撤 消" name="chexiao"></p>
<p><input type="button" value="返 回" name="fanhui"></p>

</form>
</body>
</html>

2.asp
____


<%
set fs1=server.createobject("Scripting.FileSystemObject")
filepath=server.MapPath("gonggao.txt")
set txt=fs1.opentextfile(filepath)
gg=txt.readline
response.cookies("gg")=gg
response.cookies("gg").expires="2002/12/31"
txt.close
set fs1=nothing
response.redirect "1.asp"
%>

lyhold 2002-12-30
  • 打赏
  • 举报
回复
怎么取客户端的cookie?
CTBOK 2002-12-30
  • 打赏
  • 举报
回复
分清楚什么是服务器端函数,什么是客户端函数啊
lyhold 2002-12-30
  • 打赏
  • 举报
回复
那我应该怎么写啊?上面的代码那有错

区别是,可以解释一下吗?

你有qqMA ?
可以请教你问题吗?
lbd8848 2002-12-30
  • 打赏
  • 举报
回复
有区别
lyhold 2002-12-30
  • 打赏
  • 举报
回复
代码
*************************

<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>电子公告</title>
</head>

<body>
<table border="1" width="99%" height="1" cellspacing="1">
<tr>
<td width="100%" colspan="2" height="24">
<p align="center"><font size="6" color="#0000FF">公告内容</font></td>
</tr>
<tr>
<!-- load the text file's contents-->
<%
set fs1=server.createobject("Scripting.FileSystemObject")
filepath=server.MapPath("gonggao.txt")
set txt=fs1.opentextfile(filepath)
gg=txt.readline
response.cookies("gg")=gg
response.cookies("gg").expires="2002-12-31"
txt.close
set fs1=nothing
%>
<td width="100%" rowspan="2" height="1"><textarea rows="20" name="gonggao" cols="86"><%=request.cookies("gg")%> </textarea>

</td>
<td width="30%" height="1"> 
<p><input type="button" value="保 存" name="baocun"></p>
<p> </p>
<p><input type="button" value="撤 消" name="chexiao"></p>
<p> </p>
<p><input type="button" value="返 回" name="fanhui"></p>
<p> </p>
<p> </p>
</td>
</tr>

</table>
<br>
</body>
</html>


<SCRIPT LANGUAGE="VBScript">
Sub baocun_OnClick()
'set fs=server.createobject("Scripting.FileSystemObject")
'filepath=server.MapPath("gonggao.txt")
'set txt=fs.createtextfile(filepath,true)
'txt.writeline("ddddd")
'txt.close
document.all.gonggao.value=<% =request.cookies("gg")%>

End Sub
</script>

<SCRIPT LANGUAGE="vbScript">
Sub chexiao_OnClick
document.all.chexiao.value = "test"
End Sub
</script>

lyhold 2002-12-30
  • 打赏
  • 举报
回复
〈%%〉中的代码和
〈language =vbscript>
.....
</script>

有区别吗??
to lbd8848
谢谢你的耐心回来,感谢
lyhold 2002-12-30
  • 打赏
  • 举报
回复
我现在是这样的。页面载入的时候跟一个text控件副值,
如果用户修改后点保存则写到文本文件,否则把以前的哪个值(存在cookie)
去出来重新副给text
lbd8848 2002-12-30
  • 打赏
  • 举报
回复
对,不过这个应存在于vbscript脚本中,不在<%%>中
lyhold 2002-12-30
  • 打赏
  • 举报
回复
Sub baocun_OnClick()
'set fs=server.createobject("Scripting.FileSystemObject")
'filepath=server.MapPath("gonggao.txt")
'set txt=fs.createtextfile(filepath,true)
'txt.writeline("ddddd")
'txt.close
document.all.gonggao.value=<% =request.cookies("gg")%>

End Sub
我这是把cookies的值副给gonggao这个控件!!

lbd8848 2002-12-30
  • 打赏
  • 举报
回复
response.cookies("gonggao").expires="2002/12/30"
加载更多回复(14)

28,391

社区成员

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

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