如何在SUB内使用response对象的cookies方法?

wggipkhgef 2003-09-01 03:25:06
我现在使用<a href=# onclick=closecookies()>点击</a>
来调用
<script language=vbscript>
sub closecookies()
response.cookies("...")=...
end sub
</script>
我在closecookies里面使用了response.cookies()方法


错误提示:缺少对象"response",不晓得是怎么回事,我明明在里面用了response对象啊!
各位帮帮怎么解决啊?
...全文
41 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
wggipkhgef 2003-09-04
  • 打赏
  • 举报
回复
如果分不够的话,我可以另开一100分贴到“非技术区”内给分~~~~~~~~~~~~~~~~~~~~``


wggipkhgef 2003-09-04
  • 打赏
  • 举报
回复
生成cookies和读取cookies我都搞定了,当然也很感谢gdeljyh(阿江),
我现在是想知道怎么让过程和函数在调用时才执行,不调用时不执行,只进行编绎检测。
我现在是把过程放在调用的前面,一刷新不调用也执行了


好吧,我说明白点吧:
我不想设置cookies的失效时间,只是想点击"注销/退出"时就调用清空cookies的过程,
而现在我出现的问题是:不要点击只要刷新一下就已经调用了清空cookies的过程,这样人家没退出就不能使用原cookies内存在的值了。


哪位大哥帮忙一下????????????????
wggipkhgef 2003-09-03
  • 打赏
  • 举报
回复
现在过程问题解决了,但是又出了一个问题
我把过程放在那里,不调用也会自动执行,这怎么行啊?
我的目的是调用的时候就执行,不调用就不执行,
现在怎么会这样啊?
ceocio 2003-09-02
  • 打赏
  • 举报
回复
应该这样
<%
你的过程
%>
服务器端执行的话需要包含在定界符中
wggipkhgef 2003-09-02
  • 打赏
  • 举报
回复
不是吧?
document.cookies?
错误提示:对象不支持此属性或方法:'document.cookies'
gdeljyh 2003-09-02
  • 打赏
  • 举报
回复
<HTML>
<HEAD>
<META name=VI60_defaultClientScript content=VBScript>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
<!--


'函数:SetCookie(strCookieName,strCookieValue)
'功能:设置Cookie
Sub SetCookie(strCookieName,strCookieValue)
On Error Resume Next
Dim strTemp
strTemp=strCookieName & "=" & strCookieValue
strTemp=strTemp & ";expires=" & Weekday(Date,vbUseSystem) & ","
strTemp=strTemp & Day(Date)+1 & "-"
strTemp=strTemp & Month(Date) & "-"
strTemp=strTemp & Year(Date)
strTemp=strTemp & " 12:00:00 "
strTemp=strTemp & " GMT"
strTemp=strTemp & ";Path=/"
document.cookie=strTemp
End Sub

'函数:GetCookie(strCookieName)
'功能:读取Cookie,若不存在名称为strCookieName的Cookie则返回NotExist
Function GetCookie(strCookieName)
On Error Resume Next
Dim strCookie
Dim intNamePos
Dim intNameLength
Dim intValueLength
Dim intNextSemicolon
Dim strTempCookie
strCookie=Document.Cookie
strTempCookie=strCookie
GetCookie=""
If strCookieName<>"" Then
intNamePos=InStr(1,strTempCookie,strCookieName,1)
intNameLength = Len(strCookieName)
Do While intNamePos>0
strTempCookie=Right(strTempCookie,Len(strTempCookie)-intNamePos+1)
If Mid(strTempCookie,intNameLength+1,1)<>"=" Then
Exit Function
Else
intNextSemicolon=InStr(strTempCookie,";")
If intNextSemicolon=0 Then
intNextSemicolon=Len(strTempCookie)+1
End If
If intNextSemicolon=(intNameLength+2) Then
Exit Function
Else
intValueLength=intNextSemicolon-intNameLength-2
GetCookie = Mid(strTempCookie, intNameLength + 2, intValueLength)
End If
End If
intNamePos=InStr(intNamePos+intNameLength,strTempCookie,strCookieName,1)
Loop
End If
End Function

Call SetCookie("Name","gdeljyh")
document.write "Name=" & GetCookie("Name") & "<BR>"
-->
</SCRIPT>
</HEAD>
<BODY>

<P> </P>

</BODY>
</HTML>
ttt2 2003-09-02
  • 打赏
  • 举报
回复
response.cookie 是服务器端对象而你的函数是客户端函数

应该用document.cookie
wggipkhgef 2003-09-02
  • 打赏
  • 举报
回复
哪位大哥有解决办法啊????

我等了一个晚上居然还是没人回复啊!
wggipkhgef 2003-09-02
  • 打赏
  • 举报
回复
没有人知道吗?

28,408

社区成员

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

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