How I can Change Css Style Sheet at runtime?
I have different css style sheets.Each of which has different color
scheme for the web site.I have used the <Link rel="stylesheet" type="text/css"
href="css/stylesheet.css"> tag to apply the css style sheet.
I want to allow the user to choose from those different color schemes
and apply that color scheme to entire web site.I am using ASP.Net & C# Language.So
How I change the css style sheet at runtime. Basically, I want to change
the href attribute of <Link> tag. Is there any way to apply style sheet that
user selects?
Thank you,
Geeta
Re: How I can Change Css Style Sheet at runtime?
This isn't a C# question... but I'll answer it anyway.
I can't think of a clean and straightforward way to do this client-side,
but server-side it is pretty easy.
Assuming you have a page containing a form which allows the user to choose
between the stylesheets, you can then keep the name of the current stylesheet
in a session variable and write it into the Link tag on each page.
If you can't include server-side code in your pages, the least painful client
side options I can think of are (1) have multiple copies of the pages (use
a custom app to generate them though!), or (2) use javascript functions to
set the different styles up.
HTH
James.
"Geeta" <giit@usa.net> wrote:
>
> I have different css style sheets.Each of which has different color
>scheme for the web site.I have used the <Link rel="stylesheet" type="text/css"
>href="css/stylesheet.css"> tag to apply the css style sheet.
> I want to allow the user to choose from those different color schemes
>and apply that color scheme to entire web site.I am using ASP.Net & C# Language.So
>How I change the css style sheet at runtime. Basically, I want to change
>the href attribute of <Link> tag. Is there any way to apply style sheet
that
>user selects?
>
>
>Thank you,
>Geeta
>
>