Hi. I found the following code that seems to work great to load a random .css file. Problem is, the code does not validate properly with 1.0 the transitional xhtml specs.
It seems to be the backslashes and ‘+’ signs that are flagging as non-complaint. Mostly from this line..
[CODE]
document.write(‘<link rel=”stylesheet” href=”‘ +randstylesheet+'” type=”text/css”>’);
Here is the code..
[CODE]
<script type=”text/javascript”>
function randomcss(min,max)
{
var randstylesheet = “indextest.css”;
var randnumber = (Math.round(Math.random()*(max-min)))+min;
switch(randnumber)
{
case 0: randstylesheet = “/indextest.css”;break
case 1: randstylesheet = “/site.css”;break
}
document.write(‘<link rel=”stylesheet” href=”‘ +randstylesheet+'” type=”text/css”>’);
}
randomcss(0,8);
</script>
Any ideas?