Hi can someone please help. I am trying to creat an "Adjust Font Size" feature for my site. Someone helped me set this up, but I cannot seem to the cookies to work. Through the use of cookies and ASP I would like the font that the user selects to be remembered. Also, I do not like how a new page opens and falls back on the current one. How can that be fixed? So far I have the following code, which is in 5 files. ============ default.asp ============ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <% styleSheet = request.cookies("styleSheet") if styleSheet = "" OR ISNULL(styleSheet) then styleSheet = "style.css" end if %> <link href="<%=styleSheet%>" rel="stylesheet" type="text/css" /> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> </td> <td> </td> <td><a href="style.asp?style=1" target="_blank">size 1</a>, <a href="style.asp?style=2" target="_blank">size 2</a>, <a href="style.asp?style=3" target="_blank">size 3</a> </td> </tr> <tr> <td> </td> <td>Normal Text </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> </table> </body> </html> ============ style.asp ============ <% style = request.querystring("style") Select Case style Case "1" response.cookies("styleSheet") = "style.css" Case "2" response.cookies("styleSheet") = "bigger.css" Case "3" response.cookies("styleSheet") = "biggest.css" End Select %> <script language="JavaScript"> window.opener.location.reload(); window.close(); </script> ============ style.css ============ body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; line-height: 1.2em; margin: 0px; } ============ bigger.css ============ body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: medium; line-height: 1.2em; margin: 0px; } ============ biggest.css ============ body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: large; line-height: 1.2em; margin: 0px; } Can someone please rewrite the code so that the issues mentioned above are corrected? Also, is there a better way to do this via ASP, CSS, and cookies? I really need to get this working as soon as possible. Project deadline, you know the drill. Please advise! Thanks!
Hi, Cokkies: If you want to store data for session you can use session variable and if you want it to store for application lavel you can use aplication varieable. New Window: You are using target="_blank" in your hiperlinks thats why the hiperlink is pop uped in new window. Try it without using target. Ash
Ash, Thanks for your reply. I am really new to both asp and cookies. I am not sure what type of variable would be best for me here. Can you please let me know all of the code that I would need to insert, and where? Also, I removed the target="_blank" but it is hanging on the style.asp file. I think this may be causing the problem: <script language="JavaScript"> window.opener.location.reload(); window.close(); </script> When the user clicks on one of the font options from default.asp I just want the page to refresh. Can you please look at all my code and let me know what I need to add? THANKS!
In your page style.asp replace <script language="JavaScript"> window.opener.location.reload(); window.close(); </script> with Response.redirect("default.asp") and see how it goes