HAL-PC Web Technolgies SIG

Mail List | SIG Leader

CSS Style Switcher in ASP

HAL-PC Web Technologies SIG

Below is the server side code for creating an asp based styleswitcher.

Note that if you wish to use this on more than one page you should set the preferred stylesheet number in a cookie and test for it first since this is not a persistant selection but one I created for this presentation only,

<% 'css switcher
dim style
style=request.querystring("style")

Select Case style
	Case "0"
		style = "fixed.css"
	Case "1" 
		style = "relative.css" 
	Case "2" 
		style = "static.css"
	Case "3" 
		style = "absolute.css"
	Case Else
		sytle = "no.css"
End Select

%>
<!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>
<title>Oct 2002 CSS Level 1 Base Page
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="format.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="<%=style%>" />

</head>

<body>
<div id="header">
<h1>CSS Level 2 Example Page
<p>In order to demonstrate how various browsers use CSS Level 2 in stylesheets. 
  This page contains a stylesheet switcher that will enable you to test the stylesheets 
  we are using in today's demonstration. (This section is in div "header")

/div> div class="switcher"> form action="basic.asp" method="get" name="style" id="style"> input name="style" type="radio" value="" title="0"/> No Positioning <input name="style" type="radio" value="0"/> Fixed <input type="radio" name="style" value="1"/> Relative  <input type="radio" name="style" value="2"/> Static   <input name="style" type="radio" value="3"/> Absolute    <input type="submit" name="Submit" value="Change Style" title="Change Style" class="submit" /> (form in div "switcher") /form> /div>

About Us | Site Map | Advanced Search | Privacy Policy | Contact Us | ©1999-2006 HAL-PC Web Technologies SIG Leader Cheryl D. Wise