Forum Moderators: open

Message Too Old, No Replies

switching file with a dropdown

         

mtmmtm

9:53 pm on Dec 31, 2004 (gmt 0)



Hi,
what I'd like to do is have a few style sheets, then have a dropdown box where the user can select a theme and it will switch the style sheet in the link rel= according to which theme they chose. This should be pretty simple but I'm not much of a programmer. Can anyone help me out with the code for this?

Thanks

Zaphod Beeblebrox

12:52 pm on Jan 2, 2005 (gmt 0)

10+ Year Member



With a page reload:


<html>
<head>
<%
Select Case Request.Form("theme")
Case "Theme1"
Response.Write("<link rel='stylesheet' href='theme1.css' type='text/css'>" & vbCrlf)
Case "Theme2"
Response.Write("<link rel='stylesheet' href='theme2.css' type='text/css'>" & vbCrlf)
Case Else
Response.Write("<link rel='stylesheet' href='default.css' type='text/css'>" & vbCrlf)
End Select
%>
</head>
<body>
<form name='f' method='post'>
<select name='theme' onSelect='Javascript:f.submit();'>
<option value='0'>Default theme</option>
<option value='1'>Theme 1</option>
<option value='2'>Theme 2</option>
</select>
</form>
</body>