Mhtml
10-05-2002, 04:57 AM
I have made a little script because I got bored and thought that maybe it might be useful.
So what it does is it writes the <style> properties to the page after requesting cookies. I can make changing the colors work fine but I can't seem to get my fonts to change when I use a similar method as the font color querystrings.
changeprefs.asp:
<%if request.QueryString("r") = 1 then
response.Cookies("contentfont") = "arial"
response.Cookies("preferedstyle") = "true"
end if
if request.QueryString("r") = 2 then
response.Cookies("contentfont") = "times new roman"
response.Cookies("preferedstyle") = "true"
end if
if request.querystring("r") = 3 then
response.cookies("contentfontcolor") = request.QueryString("fontcolor")
response.Cookies("preferedstyle") = "true"
end if
if request.QueryString("r") = 4 then
response.Cookies("afont") = "arial"
response.Cookies("preferedstyle") = "true"
end if
if request.QueryString("r") = 5 then
response.Cookies("afont") = "times"
response.Cookies("preferedstyle") = "true"
end if
if request.QueryString("r") = 6 then
response.Cookies("afontcolor") = request.querystring("linkcolor")
response.Cookies("preferedstyle") = "true"
end if
%>
<%if request.Cookies("preferedstyle") = "true" then%>
<%
afont = request.Cookies("afont")
afontcolor = request.Cookies("afontcolor")
adecoration = request.Cookies("adecoration")
contentfont = request.Cookies("contentfont")
contentfontcolor = request.Cookies("contentfontcolor")
%>
index2.asp :
<%if request.Cookies("preferedstyle") = "true" then%>
<%
afont = request.Cookies("afont")
afontcolor = request.Cookies("afontcolor")
adecoration = request.Cookies("adecoration")
contentfont = request.Cookies("contentfont")
contentfontcolor = request.Cookies("contentfontcolor")
%>
<%styleIT = "<style>"
styleIT = styleIT & "a{font-family:"&afont&";color:"&afontcolor&";text-decoration:"&adecoration&"};"
styleIT = styleIT & "body{font-family:"&contentfont&";color:"&contentfontcolor&"};"
styleIT = styleIT & "</style>"
%>
<%else%>
<%styleIT = "<style>"
styleIT = styleIT & "a{font-family:arial;color:072f95;text-decoration:none};"
styleIT = styleIT & "body{font-family:arial;color:808080};"
styleIT = styleIT & "</style>"
%>
<html>
<head>
<%=styleIT%>
</head...
So what it does is it writes the <style> properties to the page after requesting cookies. I can make changing the colors work fine but I can't seem to get my fonts to change when I use a similar method as the font color querystrings.
changeprefs.asp:
<%if request.QueryString("r") = 1 then
response.Cookies("contentfont") = "arial"
response.Cookies("preferedstyle") = "true"
end if
if request.QueryString("r") = 2 then
response.Cookies("contentfont") = "times new roman"
response.Cookies("preferedstyle") = "true"
end if
if request.querystring("r") = 3 then
response.cookies("contentfontcolor") = request.QueryString("fontcolor")
response.Cookies("preferedstyle") = "true"
end if
if request.QueryString("r") = 4 then
response.Cookies("afont") = "arial"
response.Cookies("preferedstyle") = "true"
end if
if request.QueryString("r") = 5 then
response.Cookies("afont") = "times"
response.Cookies("preferedstyle") = "true"
end if
if request.QueryString("r") = 6 then
response.Cookies("afontcolor") = request.querystring("linkcolor")
response.Cookies("preferedstyle") = "true"
end if
%>
<%if request.Cookies("preferedstyle") = "true" then%>
<%
afont = request.Cookies("afont")
afontcolor = request.Cookies("afontcolor")
adecoration = request.Cookies("adecoration")
contentfont = request.Cookies("contentfont")
contentfontcolor = request.Cookies("contentfontcolor")
%>
index2.asp :
<%if request.Cookies("preferedstyle") = "true" then%>
<%
afont = request.Cookies("afont")
afontcolor = request.Cookies("afontcolor")
adecoration = request.Cookies("adecoration")
contentfont = request.Cookies("contentfont")
contentfontcolor = request.Cookies("contentfontcolor")
%>
<%styleIT = "<style>"
styleIT = styleIT & "a{font-family:"&afont&";color:"&afontcolor&";text-decoration:"&adecoration&"};"
styleIT = styleIT & "body{font-family:"&contentfont&";color:"&contentfontcolor&"};"
styleIT = styleIT & "</style>"
%>
<%else%>
<%styleIT = "<style>"
styleIT = styleIT & "a{font-family:arial;color:072f95;text-decoration:none};"
styleIT = styleIT & "body{font-family:arial;color:808080};"
styleIT = styleIT & "</style>"
%>
<html>
<head>
<%=styleIT%>
</head...