< %@ LANGUAGE="VBscript" % >
< %
RequestName = Request.Form("Name")
RequestLeaveMeAlone = Request.Form("LeaveMeAlone")
If RequestName < >"" or RequestLeaveMeAlone < >"" then
' 在同一個(gè)頁(yè)面中檢查表單變量.
Response.Cookies("MySiteVisitorName") = RequestName
Response.Cookies("MySiteVisitorName").Expires = #January 01, 2008#
Response.Cookies("MySiteLeaveMeAlone") = RequestLeaveMeAlone
Response.Cookies("MySiteLeaveMeAlone").Expires = #January 01, 2008#
' 如果表單變量存在,就創(chuàng)建Cookie,并設(shè)置到期時(shí)間.
End if
VisitorName = request.Cookies("MySiteVisitorName")
LeaveMeAlone = request.Cookies("MySiteLeaveMeAlone")
' 讀取Cookie.
If VisitorName ="" and LeaveMeAlone ="" then
' 如果用戶機(jī)子上不存在該Cookie,就創(chuàng)建一個(gè)表單詢問(wèn)相關(guān)信息.
% >
< html >
< head >
<title>隨風(fēng)起舞歡迎你!</title>
< /head >
< body bgcolor="#ccffff" text="black" link="navy" vlink="purple" >
< DIV ALIGN="CENTER" >
< form action="index.asp" method="POST" >
< H2 >歡迎光臨精彩春風(fēng)< /H2 >
您的網(wǎng)上昵稱是< input type="text" name="name" > (您可以選擇不回答而直接點(diǎn)擊"發(fā)送"按鈕)
< br >< br >
< input type="hidden" name="LeaveMeAlone" value="x" >
< input type="submit" value="發(fā)送" >
< /FORM >
< /DIV >
< /body >
< %
End if
If VisitorName < > "" then
Response.write "歡迎您," & VisitorName & "! 這兒就是您的家!"
' 如果Cookie和用戶名都已存在,則顯示一個(gè)歡迎頁(yè)面.
End if
' 結(jié)束其余代碼.
% >
更多信息請(qǐng)查看IT技術(shù)專欄