< %@ 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#
' 如果表單變數存在,就建立Cookie,並設定到期時間.
End if
VisitorName = request.Cookies("MySiteVisitorName")
LeaveMeAlone = request.Cookies("MySiteLeaveMeAlone")
' 讀取Cookie.
If VisitorName ="" and LeaveMeAlone ="" then
' 如果使用者機子上不存在該Cookie,就建立一個表單詢問相關資訊.
% >
< 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 >
您的網上暱稱是< input type="text" name="name" > (您可以選擇不回答而直接點擊"發送"按鈕)
< br >< br >
< input type="hidden" name="LeaveMeAlone" value="x" >
< input type="submit" value="發送" >
< /FORM >
< /DIV >
< /body >
< %
End if
If VisitorName < > "" then
Response.write "歡迎您," & VisitorName & "! 這兒就是您的家!"
' 如果Cookie和使用者名稱都已存在,則顯示一個歡迎頁面.
End if
' 結束其餘代碼.
% >
[1]