Load a random CSS file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- this will print one of these: | |
<link rel="stylesheet" type="text/css" href="css/bk1.css" /> | |
<link rel="stylesheet" type="text/css" href="css/bk2.css" /> | |
<link rel="stylesheet" type="text/css" href="css/bk3.css" /> | |
<link rel="stylesheet" type="text/css" href="css/bk4.css" /> | |
<link rel="stylesheet" type="text/css" href="css/bk5.css" /> | |
<link rel="stylesheet" type="text/css" href="css/bk6.css" /> --> | |
<script type="text/javascript" src="RANDOM_CSS_javascript.js"></script> | |
<script type="text/javascript"> | |
RANDOM_CSS.printlinktag(); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var RANDOM_CSS = { | |
cssfiles : ['bk1.css','bk2.css','bk3.css','bk4.css','bk5.css','bk6.css'], | |
pathtocss : 'css/', | |
getrandomcss : function() { return this.cssfiles[Math.floor(Math.random()*this.cssfiles.length)]; }, | |
getlinktag : function() { return '<link rel="stylesheet" type="text/css" href="'+this.pathtocss+this.getrandomcss()+'" />'; }, | |
printlinktag : function() { document.write(this.getlinktag()); } | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment