Increase/Decrease Font Size (URGENT!!!)

Discussion in 'C#' started by Gsx_Eclipse, Jul 19, 2006.

  1. #1
    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>&nbsp;</td>
    <td>&nbsp;</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>&nbsp;</td>
    <td>Normal Text </td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</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!
     
    Gsx_Eclipse, Jul 19, 2006 IP
  2. cbl_4u

    cbl_4u Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    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
     
    cbl_4u, Jul 20, 2006 IP
  3. Gsx_Eclipse

    Gsx_Eclipse Guest

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    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!
     
    Gsx_Eclipse, Jul 20, 2006 IP
  4. 50plus

    50plus Guest

    Messages:
    234
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    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
     
    50plus, Jul 21, 2006 IP