ASP stylesheet switcher with conditional comments

This is a discussion on "ASP stylesheet switcher with conditional comments" within the Classic ASP section. This forum, and the thread "ASP stylesheet switcher with conditional comments are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Apr 18th, 2006, 21:41
New Member
Join Date: Apr 2006
Location: Connecticut, USA
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
ASP stylesheet switcher with conditional comments

Hello all

I'm *very* new to Windows servers and ASP. I'm used to working on Linux/Unix sites with PHP4 or 5. However, I'm currently coding a site for a client who uses Windows 2003 IIS, ASP, and absolutely refuses to install PHP on his server - which, unfortunately makes my job more difficult.

So, I'm hoping I can get some assistance here, because I can't find the answer anywhere else.

The client is in need to a stylesheet switcher - basically for the simple task of enlarging text on the click of an image. (Yes, I am well aware that you can resize fonts by using the "view" area in your browser - but the client wants it to occur on a button click.) To accomplish this, I was in need of a stylesheet switcher, and thanks to some searching, I found a few - that basically all said the same thing.

Now, I've gotten the thing to work, no problem - however, I can't seem to get my conditional comments to switch at the same time when the button is clicked, as well. It seems the script will only change one thing - and I need it to change four! (This really sucks, because I can so do this in PHP without even batting an eyelash!)

Could anyone take a look and see how I can accomplish this in ASP? I'd really appreciate any help.

The HTML code in question is as follows. Now, I changed the name of the file from "index.html" to "index.asp" because - well that's what the tutorials said I needed to do. So here's the HTML/ASP code (just the relevant stuff):

Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="copyright" content="Copyright 2005" />
<meta name="author" content="" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="MSSmartTagsPreventParsing" content="true" />

<%
 Dim strCurrStyle
 strCurrStyle = Request.Cookies("stylesheet")
 If strCurrStyle = "" Then
   strCurrStyle = "global"
 Else
  Response.Cookies("stylesheet").Expires  = Date + 30
 End If
%>
<link rel="stylesheet" href="http://www.site.com/css/<%= strCurrStyle %>.css" />


  <!--[if IE 6]>
  <link rel="stylesheet" href="css/ie.css" />
  <![endif]-->

  <!--[if IE 5.5000]>
  <link rel="stylesheet" href="css/ie55.css" />
  <![endif]-->

  <!--[if IE 5]>
  <link rel="stylesheet" href="css/ie5.css" />
  <![endif]-->

</head>
As you can see above, there's three separate conditional comment areas, for IE6, IE5.5 and IE5.0. I need these to also change when the button is clicked.

Below is the actual script file that makes this thing work:

Code: Select all
<%
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 ("index.asp")
%>
So, any help in editing this code to change the four lines (instead of just the one) would be so great, you have no idea.

Thanks so much!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Apr 19th, 2006, 12:44
Rob's Avatar
Rob Rob is offline
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,192
Blog Entries: 7
Thanks: 27
Thanked 23 Times in 20 Posts
Re: ASP stylesheet switcher with conditional comments

I would use the session object to store the variables because I think they get updated straight away in the collection and you wont need an additional page load for the new stylesheet to take effect.
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
asp, stylesheet, switcher, conditional, comments

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Type Input in Conditional Statement affirmallchance Flash & Multimedia Forum 3 Jan 9th, 2008 11:30
CSS Stylesheet Switcher Problems Jack Franklin JavaScript Forum 12 Dec 21st, 2007 00:23
Conditional IF in external stylesheet AdRock Web Page Design 6 Sep 23rd, 2007 22:45
Functions and conditional IFs AdRock PHP Forum 4 Sep 17th, 2007 08:18


All times are GMT. The time now is 12:18.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42