Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
All-Star
30184 Points
4906 Posts
Feb 17, 2012 05:42 AM|LINK
Hi,
You can try this-
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <link href="<%="css/"+cssFileName +".css"%>" rel="stylesheet" type="text/css" /> <script type="text/javascript"> </script> </head> <body> <form id="form1" runat="server"> <h1>My Website</h1> <br /> <button value="night" name="cssFile" >Night</button> <button value="day" name="cssFile" >Day</button> </form> </body> </html>
public string cssFileName = ""; protected void Page_Load(object sender, EventArgs e) { cssFileName = Request.Form["cssFile"] == null ? "Day" : Request.Form["cssFile"]; }
asteranup
All-Star
30184 Points
4906 Posts
Re: Switch css file with button click through jquery
Feb 17, 2012 05:42 AM|LINK
Hi,
You can try this-
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <link href="<%="css/"+cssFileName +".css"%>" rel="stylesheet" type="text/css" /> <script type="text/javascript"> </script> </head> <body> <form id="form1" runat="server"> <h1>My Website</h1> <br /> <button value="night" name="cssFile" >Night</button> <button value="day" name="cssFile" >Day</button> </form> </body> </html>public string cssFileName = ""; protected void Page_Load(object sender, EventArgs e) { cssFileName = Request.Form["cssFile"] == null ? "Day" : Request.Form["cssFile"]; }Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog