📄 cookies1.aspx
字号:
<html>
<script language="VB" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
If Request.Cookies("preferences1") Is Nothing
Dim Cookie As HttpCookie
Cookie = New HttpCookie("preferences1")
Cookie.Values.Add("ForeColor","black")
Cookie.Values.Add("BackColor","beige")
Cookie.Values.Add("LinkColor","blue")
Cookie.Values.Add("FontSize","8pt")
Cookie.Values.Add("FontName","Verdana")
Response.AppendCookie(Cookie)
End If
End Sub
Protected Function GetStyle(Key As String) As String
Dim Cookie As HttpCookie
Cookie = Request.Cookies("preferences1")
If Not Cookie Is Nothing
Select (Key)
Case "ForeColor" :
Return Cookie.Values("ForeColor")
Case "BackColor" :
Return Cookie.Values("BackColor")
Case "LinkColor" :
Return Cookie.Values("LinkColor")
Case "FontSize" :
Return Cookie.Values("FontSize")
Case "FontName" :
Return Cookie.Values("FontName")
End Select
End If
Return ""
End Function
</script>
<style>
body {
font: <%=GetStyle("FontSize")%> <%=GetStyle("FontName")%>;
background-color: <%=GetStyle("BackColor")%>;
}
a { color: <%=GetStyle("LinkColor")%> }
</style>
<body style="color:<%=GetStyle("ForeColor")%>">
<h3><font face="宋体">在客户端 Cookie 中存储易失数据</font></h3>
<b><a href="customize.aspx">自定义此页</a></b><p>
设想这里有某些内容 ...<br>
设想这里有某些内容 ...<br>
设想这里有某些内容 ...<br>
设想这里有某些内容 ...<br>
设想这里有某些内容 ...<br>
设想这里有某些内容 ...<br>
设想这里有某些内容 ...<br>
设想这里有某些内容 ...<br>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -