473,387 Members | 1,561 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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.css" 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_switcher.asp?style=default">Normal Size</a>
<a href="style_switcher.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.Cookies("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.QueryString("style")
If Len(strNewStyle) > 1 Then
Response.Cookies("stylesheet") = strNewStyle
Response.Cookies("stylesheet").Expires = Date + 30
End If
Response.Redirect ("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!!!!!!!!!!!!!!!!!!!!
May 1 '07 #1
1 1446
jhardman
3,406 Expert 2GB
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:
Expand|Select|Wrap|Line Numbers
  1. dim x
  2. for each x in request.cookies
  3.    response.write x & ": " & request(x) & "<br>" & vbNewLine
  4. next
  5.  
  6. for each x in request.querystring
  7.    response.write x & ": " & request(x) & "<br>" & vbNewLine
  8. 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
May 3 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: johnny | last post by:
hi all, I would like to know if the more and more websites offering the 3 font sizes option by style switching are just following a trend or have chose the best solution by an...
1
by: Kerberos | last post by:
I followed this tutorial from A List Apart: http://www.alistapart.com/articles/alternate/ It shows a way to switch easily from one style sheet to another and to store the preference in a cookie....
9
by: Chandy | last post by:
Hi, Is there any way to apply a style that will effectively block the application of any applied or inherited styles for that object and any contained objects? E.g., CSS: P {backgro...}
1
by: Amanda H. | last post by:
I posted about this a few days ago, and I got a few suggestions that fixed part of my problem. I am using a PHP script to switch external style sheets when the viewer clicks on the style link. ...
7
by: T J Rogers | last post by:
Hi folks, Below is a script that I use on a site to detect the size of the browser window then automatically load an alternative stile sheet when appropriate. Its a bit clumsy, and I don't...
3
by: Daniel Greene | last post by:
Dear web writers, My lucky web visitors who are using certain browsers can select one of my style sheets out of a list, and see how my pages change "before their very eyes." Cool! But what if...
0
by: Marcel Brekelmans | last post by:
Hello, I'm making an application, but sofar I can't get its icon to appear in the task switcher. I have created an iconfile with three icons in it: 16x16, 32x32, 48x48, 24bpp. I have assigned it...
2
by: Gary Brown | last post by:
Hi, How do you remove an icon from the task switcher menu? (The one you get with ALT-TAB.) I think I asked this before but never got an answer. Now I have another app that shows an icon for...
5
by: Gretsch | last post by:
After lots of problems trying to allow the visitor to switch styles using Javascript - but encountering browser incompatabilities!! I decided to use PHP and found a simple way of doing it here: ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.