random css?

hello....is it possible to create a page that displays random css each time you reload/refresh the page? for example, one person may see it in red while the other may see it in green (according to different CSS file specs)? if it is possible, how do i go about doing that?<br />
<br />
thank you in advance....:)<!--content-->your best bet would be to use either cgi or php to randomize the look of the page. I'm not completely sure if you can actually do it using random Css or anything like that, but i know for a fact that you can do it with php or cgi scripting. hope this helps somewhat.<br />
<br />
Visit Aftermath Gaming Network<br />
<!-- m --><a class="postlink" href="http://www.aftermath-gaming.net">http://www.aftermath-gaming.net</a><!-- m --><!--content-->for that to work you will neeed to use cookies. the value of the css is stored in a cookie per user. so they can pick there own and it will stay when they visit all the time.<!--content-->Originally posted by gregmondro <br />
your best bet would be to use either cgi or php to randomize the look of the page. I'm not completely sure if you can actually do it using random Css or anything like that, but i know for a fact that you can do it with php or cgi scripting. hope this helps somewhat.<br />
<br />
Visit Aftermath Gaming Network<br />
<!-- m --><a class="postlink" href="http://www.aftermath-gaming.net">http://www.aftermath-gaming.net</a><!-- m --> <br />
<br />
<br />
thanks for the help...but what is the script for me to do it in CGI or PHP? :)<!--content-->Originally posted by scoutt <br />
for that to work you will neeed to use cookies. the value of the css is stored in a cookie per user. so they can pick there own and it will stay when they visit all the time. <br />
<br />
I'd like to keep my options open, apart from doing it in PHP or CGI as suggested earlier :)<br />
<br />
I've heard of this technique, but isn't this only be able to be done in flash? how do i make a cookie for random css? please help!<br />
<br />
thanks in advance.<!--content-->a cookie can be made from any serverside language, flash, and javascript. so you will have to pick which one you want.<br />
<br />
you make the cookie then you store the values for the css the user picked then it gets stored on the users hard drive so when they return the script reads that cookie and inserts the correct css values.<!--content-->all you need is a variable to set the file name you use.<br />
<br />
It does not matter whether you get it from a cokkie or generate it randomly or hardecode it server sid during generation. You can still do selection of css at load time this goes in the head:<br />
<br />
<script language="JavaScript"><br />
<!--<br />
var colors= new Array ("red","green","blue","pink","teal");<br />
var pntr = Math.round(Math.random()*31); <br />
var thecolor=colors[pntr];<br />
var str='<link rel="stylesheet" type="text/css" href=http://www.htmlforums.com/archive/index.php/"'+thecolor+'.css">';<br />
document.write(str);<br />
//--><br />
</script><br />
<br />
Just name the css file to match the values in the array and you are good to go.<!--content-->I need to etch that into my brain as I always forget that way. thanks Cobol<!--content-->I do the same sort of thing where both pc and MAC have to be support. you almost always need to use a different stylesheet, so I just detect the platform. Can also be used for cross-browser support, as long as the client is not stupid enough to insist NS4.x and IE have to look the same.<!--content-->
 
Back
Top