%@ LANGUAGE="VBscript" % >
%
RequestName = Request.Form("Name")
RequestLeaveMeAlone = Request.Form("LeaveMeAlone")
If RequestName >"" or RequestLeaveMeAlone >"" then
' 在同一個頁面中檢查表單變量.
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è)置到期時間.
End if
VisitorName = request.Cookies("MySiteVisitorName")
LeaveMeAlone = request.Cookies("MySiteLeaveMeAlone")
' 讀取Cookie.
If VisitorName ="" and LeaveMeAlone ="" then
' 如果用戶機子上不存在該Cookie,就創(chuàng)建一個表單詢問相關(guān)信息.
% >
html >
head >
title>隨風起舞歡迎你!/title>
/head >
body bgcolor="#ccffff" text="black" link="navy" vlink="purple" >
DIV ALIGN="CENTER" >
form action="index.asp" method="POST" >
H2 >歡迎光臨精彩春風 /H2 >
您的網(wǎng)上昵稱是 input type="text" name="name" > (您可以選擇不回答而直接點擊"發(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和用戶名都已存在,則顯示一個歡迎頁面.
End if
' 結(jié)束其余代碼.
% >
[1]