Ashley Davies
Ashley Davies

Reputation: 1903

ASP stylesheet setting

How can I choose one of multiple stylesheets using ASP? Heres my ASP at the moment:

<% T=Request.Cookies("THEME") %>

It's in the head, there are two themes. I just need somone to show me how to do a conditional operator and if it's 1 then set a stylesheet. I could complete it from there

Thanks :)

Upvotes: 0

Views: 180

Answers (2)

Brendan
Brendan

Reputation: 1883

<head>
    <%
    theme = request.cookies("theme")
    styleSheet = "<link rel=""stylesheet"" type=""text/css"" href="""
    if theme = "theme1" then
        styleSheet = styleSheet & "css/theme1.css"
    else
        styleSheet = styleSheet & "css/theme2.css"
    end if
    styleSheet = styleSheet & """ />"
    response.write(styleSheet)
    %>
</head>

Upvotes: 0

John Hartsock
John Hartsock

Reputation: 86882

VB Script Syntax

<% 
   IF (T = "MyTheme") THEN
%>
    ///HTML Or Style Sheet Tag Here
<%
   ELSE
%>
   ///HTML OR Style Sheet Tag Here
<%
   END IF
%>

Upvotes: 2

Related Questions