PDA

View Full Version : a way to random select css when page loads


pcald
09-17-2002, 10:59 PM
I would like to have multiple css' and allow for a random selection from them on each load. Any help would be greatly appreciated.

x_goose_x
09-18-2002, 05:01 AM
Don't know how cross browser it is, but works in ie6


<script>
whichone = new Array();
whichone[0] = "mystyle.css";
whichone[1] = "mystyle1.css";
whichone[2] = "mystyle2.css";
whichone[3] = "mystyle3.css";
whichone[4] = "mystyle4.css";
whichone[5] = "herstyle.css";

x = Math.round(whichone.length*Math.random());

document.write('<LINK REL="stylesheet" TYPE="text/css"

HREF="'+whichone[x]+'">');
</script>