Want a different background layout to load everytime someone views your profile?

Here's the code:
[quote]//This is a shakiro214 production
//In cooperation with friendsterTalk forum
buffy = new Array();
buffy[0]="[b]CSS_URL_1[/b]";
buffy[1]="[b]CSS_URL_2[/b]";
angel=Math.floor(Math.random() * buffy.length);
try{
document.createStyleSheet(buffy[angel]);
}
catch(e){
var css = document.createElement("link");
css.type = "text/css";
css.rel = "stylesheet";
css.href=buffy[angel];
css.media = "screen, print";
document.getElementsByTagName("head")[0].appendChild(css);
}[/quote]
To add more layouts, simply add more arrays, like so
[quote]buffy[2]="[b]CSS_URL_3[/b]";
buffy[3]="[b]CSS_URL_4[/b]";
buffy[4]="[b]CSS_URL_5[/b]";[/quote]
and so on...
If you want to use this for both IE and firefox and you are already using my 2 seperate CSS codes, simply change the name of the buffy array and the angel index when inserting the code for the second browser.

Here's a full example of what a combined code would look like, if you use seperate CSS files for IE & FF:
<">To see my [b]2 seperate CSS: 1 for IE & 1 for FF code[/b] click

[url=http://theftalk.com/t11644-seperate-files%3A.html]here[/url]
[b]That's it. You're done![/b]

[b]credits:
091011[/b] - for her [b]"New Songs On Refresh Updated"[/b] topic which gave me the idea

[b]Feruzz[/b] - for the [i]document.write[/i] work-around
Last edited by shakiro214 (2008-03-09 12:46:51)