• Welcome to The Cave of Dragonflies forums, where the smallest bugs live alongside the strongest dragons.

    Guests are not able to post messages or even read certain areas of the forums. Now, that's boring, don't you think? Registration, on the other hand, is simple, completely free of charge, and does not require you to give out any personal information at all. As soon as you register, you can take part in some of the happy fun things at the forums such as posting messages, voting in polls, sending private messages to people and being told that this is where we drink tea and eat cod.

    Of course I'm not forcing you to do anything if you don't want to, but seriously, what have you got to lose? Five seconds of your life?

Eep, stylesheet switcher.

mewtini

어떤 계절도 영원할 순 없으니까
Pronoun
she/her
Hi!

I'm no whiz at HTML/CSS, but I have some knowledge at it; probably best to get that out there.

So I have three stylesheets, the default is titled "title="stylesheet", the other two are "title="alternate stylesheet", so I can switch between them via browser, but I'd like to somehow grab cookies and get it together dynamically. I have absolutely no idea how to do that, and I have no knowledge in any other languages (I dabbled in Java and JavaScript, but not very far beyond "Hello World!"). So, I don't know, but. Help?
 
I am not quite sure what you wish to do, but I'm guessing that you want to be able to automate the changing of a stylesheet when there is a different local variable? Would it be something like the front page style switcher on TCoD?

In that case, then you could use many different languages to get it done. I would suggest Javascript, unless you needed to run this with a database, in that case then Javascript and PHP.

I think you probably want to use Javascript. There should either be two scripts, or a script with two functions. One of which, upon page load, checks for the cookie, and makes the appropriate stylesheet selection. The other would be used in an html form and creates the cookie to last a time span (probably around thirty days?). The value in the cookie would probably be either default, style1, or style2.

Running a quick google search brings this page, It should help in this case:
http://www.htmlgoodies.com/beyond/javascript/article.php/3470821/So-You-Want-To-Set-A-Cookie-Huh.htm

And if you have any problems, you can go to Stack Overflow and check for answers to that specific problem.

Sorry I couldn't help much. I have only done basic scripting with javascript and am not familiar with it, because I use PHP more often.
 
Back
Top Bottom