CSS style switcher asp.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • blackburnj55
    New Member
    • Apr 2007
    • 5

    CSS style switcher asp.net

    I am constructing a website for a bike shop. I want users with impaired vision or disabilities to be able to change the font size on the page.

    I have created two ".css" files called "default.cs s" and "huge.css" which are on my server in the "templates" folder.

    On my homepage (log.asp) i have the following code to execute the change:

    <p><a href="style_swi tcher.asp?style =default">Norma l Size</a>
    <a href="style_swi tcher.asp?style =huge">Large Size</a>
    </p>

    This is the code for the file "style_switcher .asp"

    <head>
    <%
    Dim strCurrStyle
    strCurrStyle = Request.Cookies ("stylesheet ")
    If strCurrStyle = "" Then
    strCurrStyle = "default"
    Else
    Response.Cookie s("stylesheet") .Expires = Date + 30
    End If
    %>
    <style type="text/css" media="screen">
    @import url(http://wwww.mywebsite. com/extension<%= strCurrStyle %>.css);
    </style>
    </head>

    <% Dim strNewStyle
    strNewStyle = Request.QuerySt ring("style")
    If Len(strNewStyle ) > 1 Then
    Response.Cookie s("stylesheet ") = strNewStyle
    Response.Cookie s("stylesheet") .Expires = Date + 30
    End If
    Response.Redire ct ("log.asp") %>


    My problem is that the code executes, refreshes "log.asp" but without making any changes to the size of the text! something is missing somewhere - please help me!!!!!!!!!!!!! !!!!!!!
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    Woah, that's a lot of exclamation points! You must really need help.

    One troubleshooting technique I like to do when request data isn't handled properly is list all of my request data:
    Code:
    dim x
    for each x in request.cookies
       response.write x & ": " & request(x) & "<br>" & vbNewLine
    next
    
    for each x in request.querystring
       response.write x & ": " & request(x) & "<br>" & vbNewLine
    next
    having said that, I don't see anything here that is obviously wrong. If there is no cookie, the style goes to default. Otherwise it stays the same. After that the querystring is checked which should supersede the cookie. It looks fine, so I'm guessing the problem is on log.asp. Try adding the above code to log.asp and see if all of the data is still there. What logic controls the stylesheet choice on log.asp?

    Jared

    Comment

    Working...